id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
26,300
libgraviton/graviton
src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php
I18nRqlParsingListener.isTranslatableFieldNode
private function isTranslatableFieldNode() { $isTranslatableField = false; if (isset($this->mapping[$this->className]) && in_array($this->getDocumentFieldName(), $this->mapping[$this->className]) ) { $isTranslatableField = true; } return $isTranslatab...
php
private function isTranslatableFieldNode() { $isTranslatableField = false; if (isset($this->mapping[$this->className]) && in_array($this->getDocumentFieldName(), $this->mapping[$this->className]) ) { $isTranslatableField = true; } return $isTranslatab...
[ "private", "function", "isTranslatableFieldNode", "(", ")", "{", "$", "isTranslatableField", "=", "false", ";", "if", "(", "isset", "(", "$", "this", "->", "mapping", "[", "$", "this", "->", "className", "]", ")", "&&", "in_array", "(", "$", "this", "->"...
Returns true if the current node affects a translatable field @return bool true if yes, false if not
[ "Returns", "true", "if", "the", "current", "node", "affects", "a", "translatable", "field" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php#L158-L168
26,301
libgraviton/graviton
src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php
I18nRqlParsingListener.getEqNode
private function getEqNode($fieldName, $fieldValue) { $node = new EqNode($fieldName, $fieldValue); $this->createdNodes[] = $node; return $node; }
php
private function getEqNode($fieldName, $fieldValue) { $node = new EqNode($fieldName, $fieldValue); $this->createdNodes[] = $node; return $node; }
[ "private", "function", "getEqNode", "(", "$", "fieldName", ",", "$", "fieldValue", ")", "{", "$", "node", "=", "new", "EqNode", "(", "$", "fieldName", ",", "$", "fieldValue", ")", ";", "$", "this", "->", "createdNodes", "[", "]", "=", "$", "node", ";...
get EqNode instance and remember that we created it.. @param string $fieldName field name @param string $fieldValue field value @return EqNode node
[ "get", "EqNode", "instance", "and", "remember", "that", "we", "created", "it", ".." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php#L178-L183
26,302
libgraviton/graviton
src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php
I18nRqlParsingListener.isOurNode
private function isOurNode($node) { foreach ($this->createdNodes as $createdNode) { if ($createdNode == $node) { return true; } } return false; }
php
private function isOurNode($node) { foreach ($this->createdNodes as $createdNode) { if ($createdNode == $node) { return true; } } return false; }
[ "private", "function", "isOurNode", "(", "$", "node", ")", "{", "foreach", "(", "$", "this", "->", "createdNodes", "as", "$", "createdNode", ")", "{", "if", "(", "$", "createdNode", "==", "$", "node", ")", "{", "return", "true", ";", "}", "}", "retur...
check if we created the node previously @param EqNode $node node @return bool true if yes, false otherwise
[ "check", "if", "we", "created", "the", "node", "previously" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php#L192-L200
26,303
libgraviton/graviton
src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php
I18nRqlParsingListener.nodeFieldNameHasLanguage
private function nodeFieldNameHasLanguage() { $parts = explode('.', $this->node->getField()); if (!empty($parts)) { $lastPart = $parts[count($parts) - 1]; // only remove when language if (in_array($lastPart, $this->intUtils->getLanguages())) { retu...
php
private function nodeFieldNameHasLanguage() { $parts = explode('.', $this->node->getField()); if (!empty($parts)) { $lastPart = $parts[count($parts) - 1]; // only remove when language if (in_array($lastPart, $this->intUtils->getLanguages())) { retu...
[ "private", "function", "nodeFieldNameHasLanguage", "(", ")", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "this", "->", "node", "->", "getField", "(", ")", ")", ";", "if", "(", "!", "empty", "(", "$", "parts", ")", ")", "{", "$", "lastP...
if the node field name targets a language or not @return bool true if yes, false otherwise
[ "if", "the", "node", "field", "name", "targets", "a", "language", "or", "not" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php#L223-L234
26,304
libgraviton/graviton
src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php
I18nRqlParsingListener.getAllPossibleTranslatableStrings
private function getAllPossibleTranslatableStrings() { $matchingTranslations = []; // is it a glob? if ($this->node->getValue() instanceof \Xiag\Rql\Parser\DataType\Glob) { $userValue = $this->node->getValue()->toRegex(); $useWildcard = true; } else { ...
php
private function getAllPossibleTranslatableStrings() { $matchingTranslations = []; // is it a glob? if ($this->node->getValue() instanceof \Xiag\Rql\Parser\DataType\Glob) { $userValue = $this->node->getValue()->toRegex(); $useWildcard = true; } else { ...
[ "private", "function", "getAllPossibleTranslatableStrings", "(", ")", "{", "$", "matchingTranslations", "=", "[", "]", ";", "// is it a glob?", "if", "(", "$", "this", "->", "node", "->", "getValue", "(", ")", "instanceof", "\\", "Xiag", "\\", "Rql", "\\", "...
Looks up all matching Translatables and returns them uniquified @return array matching english strings
[ "Looks", "up", "all", "matching", "Translatables", "and", "returns", "them", "uniquified" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Listener/I18nRqlParsingListener.php#L252-L279
26,305
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/ReadOnlyFieldsCompilerPass.php
ReadOnlyFieldsCompilerPass.process
public function process(ContainerBuilder $container) { $this->documentMap = $container->get('graviton.document.map'); $map = []; foreach ($this->documentMap->getDocuments() as $document) { $readOnlyFields = $this->documentMap->getFieldNamesFlat( $document, ...
php
public function process(ContainerBuilder $container) { $this->documentMap = $container->get('graviton.document.map'); $map = []; foreach ($this->documentMap->getDocuments() as $document) { $readOnlyFields = $this->documentMap->getFieldNamesFlat( $document, ...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "this", "->", "documentMap", "=", "$", "container", "->", "get", "(", "'graviton.document.map'", ")", ";", "$", "map", "=", "[", "]", ";", "foreach", "(", "$", "th...
Make readOnly fields map and set it to parameter @param ContainerBuilder $container container builder @return void
[ "Make", "readOnly", "fields", "map", "and", "set", "it", "to", "parameter" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/ReadOnlyFieldsCompilerPass.php#L31-L58
26,306
duncan3dc/domparser
src/Html/Element.php
Element.hasClass
public function hasClass($className) { if (!$class = $this->dom->getAttribute("class")) { return false; } $classes = explode(" ", $class); return in_array($className, $classes, true); }
php
public function hasClass($className) { if (!$class = $this->dom->getAttribute("class")) { return false; } $classes = explode(" ", $class); return in_array($className, $classes, true); }
[ "public", "function", "hasClass", "(", "$", "className", ")", "{", "if", "(", "!", "$", "class", "=", "$", "this", "->", "dom", "->", "getAttribute", "(", "\"class\"", ")", ")", "{", "return", "false", ";", "}", "$", "classes", "=", "explode", "(", ...
Check if this element has the specified class applied to it. @param string $className The name of the class to check for (case-sensitive) @return bool
[ "Check", "if", "this", "element", "has", "the", "specified", "class", "applied", "to", "it", "." ]
d5523b58337cab3b9ad90e8d135f87793795f93f
https://github.com/duncan3dc/domparser/blob/d5523b58337cab3b9ad90e8d135f87793795f93f/src/Html/Element.php#L21-L30
26,307
libgraviton/graviton
src/Graviton/ExceptionBundle/Listener/RestExceptionListener.php
RestExceptionListener.getSerializedContent
public function getSerializedContent($content) { $serializationContext = clone $this->serializationContext; return $this->serializer->serialize( $content, 'json', $serializationContext ); }
php
public function getSerializedContent($content) { $serializationContext = clone $this->serializationContext; return $this->serializer->serialize( $content, 'json', $serializationContext ); }
[ "public", "function", "getSerializedContent", "(", "$", "content", ")", "{", "$", "serializationContext", "=", "clone", "$", "this", "->", "serializationContext", ";", "return", "$", "this", "->", "serializer", "->", "serialize", "(", "$", "content", ",", "'js...
Serialize the given content @param mixed $content Content @return string $content Json content
[ "Serialize", "the", "given", "content" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ExceptionBundle/Listener/RestExceptionListener.php#L75-L84
26,308
libgraviton/graviton
src/Graviton/RestBundle/Restriction/Manager.php
Manager.handle
public function handle(DocumentRepository $repository) { $className = $repository->getClassName(); if (isset($this->restrictedFieldMap[$className]) && !empty($this->restrictedFieldMap[$className])) { $nodes = []; foreach ($this->restrictedFieldMap[$className] as $fieldPath =>...
php
public function handle(DocumentRepository $repository) { $className = $repository->getClassName(); if (isset($this->restrictedFieldMap[$className]) && !empty($this->restrictedFieldMap[$className])) { $nodes = []; foreach ($this->restrictedFieldMap[$className] as $fieldPath =>...
[ "public", "function", "handle", "(", "DocumentRepository", "$", "repository", ")", "{", "$", "className", "=", "$", "repository", "->", "getClassName", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "restrictedFieldMap", "[", "$", "className", ...
handle the request for a given entity @param DocumentRepository $repository repository @return bool|AndNode either false if no restrictions or an AndNode for filtering
[ "handle", "the", "request", "for", "a", "given", "entity" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Restriction/Manager.php#L60-L74
26,309
libgraviton/graviton
src/Graviton/RestBundle/Restriction/Manager.php
Manager.getHandlerValue
private function getHandlerValue(DocumentRepository $repository, $fieldPath, array $handlers) { $nodes = []; foreach ($handlers as $handler) { if (!self::$handlers[$handler] instanceof HandlerInterface) { throw new \LogicException( 'Specified handler "...
php
private function getHandlerValue(DocumentRepository $repository, $fieldPath, array $handlers) { $nodes = []; foreach ($handlers as $handler) { if (!self::$handlers[$handler] instanceof HandlerInterface) { throw new \LogicException( 'Specified handler "...
[ "private", "function", "getHandlerValue", "(", "DocumentRepository", "$", "repository", ",", "$", "fieldPath", ",", "array", "$", "handlers", ")", "{", "$", "nodes", "=", "[", "]", ";", "foreach", "(", "$", "handlers", "as", "$", "handler", ")", "{", "if...
gets the value to restrict data. the handler can also return a AbstractQueryNode. not only a string @param DocumentRepository $repository the repository @param string $fieldPath path to the field (can be complex; same syntax as in rql!) @param array $handlers the specified handlers (array w...
[ "gets", "the", "value", "to", "restrict", "data", ".", "the", "handler", "can", "also", "return", "a", "AbstractQueryNode", ".", "not", "only", "a", "string" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Restriction/Manager.php#L85-L104
26,310
libgraviton/graviton
src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php
LinkHeaderResponseListener.onKernelResponse
public function onKernelResponse(FilterResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher) { $response = $event->getResponse(); $request = $event->getRequest(); // extract various info from route $routeName = $request->get('_route'); $routeParts = explode...
php
public function onKernelResponse(FilterResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher) { $response = $event->getResponse(); $request = $event->getRequest(); // extract various info from route $routeName = $request->get('_route'); $routeParts = explode...
[ "public", "function", "onKernelResponse", "(", "FilterResponseEvent", "$", "event", ",", "$", "eventName", ",", "EventDispatcherInterface", "$", "dispatcher", ")", "{", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "$", "request", "="...
add our Link header items @param FilterResponseEvent $event response listener event @param string $eventName event name @param EventDispatcherInterface $dispatcher dispatcher @return void
[ "add", "our", "Link", "header", "items" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php#L56-L94
26,311
libgraviton/graviton
src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php
LinkHeaderResponseListener.addCommonHeaders
private function addCommonHeaders(Request $request, Response $response) { // replace content-type if a schema was requested if ($request->attributes->get('schemaRequest')) { $response->headers->set('Content-Type', 'application/schema+json'); } if ($request->attributes->h...
php
private function addCommonHeaders(Request $request, Response $response) { // replace content-type if a schema was requested if ($request->attributes->get('schemaRequest')) { $response->headers->set('Content-Type', 'application/schema+json'); } if ($request->attributes->h...
[ "private", "function", "addCommonHeaders", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "// replace content-type if a schema was requested", "if", "(", "$", "request", "->", "attributes", "->", "get", "(", "'schemaRequest'", ")", ")", ...
add common headers @param Request $request request @param Response $response response @return void
[ "add", "common", "headers" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php#L104-L125
26,312
libgraviton/graviton
src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php
LinkHeaderResponseListener.addSelfLinkHeader
private function addSelfLinkHeader($routeName, $routeType, Request $request) { $routeParams = $request->get('_route_params'); if (!is_array($routeParams)) { $routeParams = []; } if (($routeType == 'post' || $routeType == 'postNoSlash') || $routeType != 'all') { ...
php
private function addSelfLinkHeader($routeName, $routeType, Request $request) { $routeParams = $request->get('_route_params'); if (!is_array($routeParams)) { $routeParams = []; } if (($routeType == 'post' || $routeType == 'postNoSlash') || $routeType != 'all') { ...
[ "private", "function", "addSelfLinkHeader", "(", "$", "routeName", ",", "$", "routeType", ",", "Request", "$", "request", ")", "{", "$", "routeParams", "=", "$", "request", "->", "get", "(", "'_route_params'", ")", ";", "if", "(", "!", "is_array", "(", "...
Add "self" Link header item @param string $routeName route name @param string $routeType route type @param Request $request request @return string the "self" link url
[ "Add", "self", "Link", "header", "item" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php#L136-L186
26,313
libgraviton/graviton
src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php
LinkHeaderResponseListener.generateSchemaLinkHeader
private function generateSchemaLinkHeader($routeName, Request $request, Response $response) { if ($request->get('_route') != 'graviton.core.static.main.all') { try { $schemaRoute = SchemaUtils::getSchemaRouteName($routeName); $this->linkHeader->add( ...
php
private function generateSchemaLinkHeader($routeName, Request $request, Response $response) { if ($request->get('_route') != 'graviton.core.static.main.all') { try { $schemaRoute = SchemaUtils::getSchemaRouteName($routeName); $this->linkHeader->add( ...
[ "private", "function", "generateSchemaLinkHeader", "(", "$", "routeName", ",", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "if", "(", "$", "request", "->", "get", "(", "'_route'", ")", "!=", "'graviton.core.static.main.all'", ")", "{...
generates the schema rel in the Link header @param string $routeName route name @param Request $request request @param Response $response response @return void
[ "generates", "the", "schema", "rel", "in", "the", "Link", "header" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php#L198-L213
26,314
libgraviton/graviton
src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php
LinkHeaderResponseListener.generatePagingLinksHeaders
private function generatePagingLinksHeaders($routeName, Request $request, Response $response) { $rql = ''; if ($request->attributes->get('hasRql', false)) { $rql = $request->attributes->get('rawRql', ''); } $this->generateLinks( $routeName, $reque...
php
private function generatePagingLinksHeaders($routeName, Request $request, Response $response) { $rql = ''; if ($request->attributes->get('hasRql', false)) { $rql = $request->attributes->get('rawRql', ''); } $this->generateLinks( $routeName, $reque...
[ "private", "function", "generatePagingLinksHeaders", "(", "$", "routeName", ",", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "rql", "=", "''", ";", "if", "(", "$", "request", "->", "attributes", "->", "get", "(", "'hasRql'",...
generates the paging Link header items @param string $routeName route name @param Request $request request @param Response $response response @return void
[ "generates", "the", "paging", "Link", "header", "items" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php#L224-L244
26,315
libgraviton/graviton
src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php
LinkHeaderResponseListener.generateLinks
private function generateLinks($route, $page, $numPages, $perPage, Request $request, $rql) { if ($page > 2) { $this->generateLink($route, 1, $perPage, 'first', $request, $rql); } if ($page > 1) { $this->generateLink($route, $page - 1, $perPage, 'prev', $request, $rql)...
php
private function generateLinks($route, $page, $numPages, $perPage, Request $request, $rql) { if ($page > 2) { $this->generateLink($route, 1, $perPage, 'first', $request, $rql); } if ($page > 1) { $this->generateLink($route, $page - 1, $perPage, 'prev', $request, $rql)...
[ "private", "function", "generateLinks", "(", "$", "route", ",", "$", "page", ",", "$", "numPages", ",", "$", "perPage", ",", "Request", "$", "request", ",", "$", "rql", ")", "{", "if", "(", "$", "page", ">", "2", ")", "{", "$", "this", "->", "gen...
generate headers for all paging links @param string $route name of route @param integer $page page to link to @param integer $numPages number of all pages @param integer $perPage number of records per page @param Request $request request to get rawRql from @param string $rql rql query string @return v...
[ "generate", "headers", "for", "all", "paging", "links" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php#L258-L272
26,316
libgraviton/graviton
src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php
LinkHeaderResponseListener.generateLink
private function generateLink($routeName, $page, $perPage, $type, Request $request, $rql) { $limit = ''; if ($perPage) { $page = ($page - 1) * $perPage; $limit = sprintf('limit(%s,%s)', $perPage, $page); } if (strpos($rql, 'limit') !== false) { $rq...
php
private function generateLink($routeName, $page, $perPage, $type, Request $request, $rql) { $limit = ''; if ($perPage) { $page = ($page - 1) * $perPage; $limit = sprintf('limit(%s,%s)', $perPage, $page); } if (strpos($rql, 'limit') !== false) { $rq...
[ "private", "function", "generateLink", "(", "$", "routeName", ",", "$", "page", ",", "$", "perPage", ",", "$", "type", ",", "Request", "$", "request", ",", "$", "rql", ")", "{", "$", "limit", "=", "''", ";", "if", "(", "$", "perPage", ")", "{", "...
generate link header passed on params and type @param string $routeName use with router to generate urls @param integer $page page to link to @param integer $perPage number of items per page @param string $type rel type of link to generate @param Request $request request to get rawRql from @param strin...
[ "generate", "link", "header", "passed", "on", "params", "and", "type" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/LinkHeaderResponseListener.php#L286-L308
26,317
libgraviton/graviton
src/Graviton/AnalyticsBundle/Model/AnalyticModel.php
AnalyticModel.getAggregate
public function getAggregate($params = []) { if ($this->getMultipipeline()) { $pipelines = []; foreach ($this->class as $name => $className) { if (!class_exists($className)) { throw new \LogicException("Analytics class '" . $className . "' does not...
php
public function getAggregate($params = []) { if ($this->getMultipipeline()) { $pipelines = []; foreach ($this->class as $name => $className) { if (!class_exists($className)) { throw new \LogicException("Analytics class '" . $className . "' does not...
[ "public", "function", "getAggregate", "(", "$", "params", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "getMultipipeline", "(", ")", ")", "{", "$", "pipelines", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "class", "as", "$", ...
Build a output Db Model aggregation pipeline array. @param array $params params @return array the pipeline
[ "Build", "a", "output", "Db", "Model", "aggregation", "pipeline", "array", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Model/AnalyticModel.php#L279-L301
26,318
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/RestrictionFieldsCompilerPass.php
RestrictionFieldsCompilerPass.process
public function process(ContainerBuilder $container) { $this->documentMap = $container->get('graviton.document.map'); $map = []; foreach ($this->documentMap->getDocuments() as $document) { $restrictionFields = $this->documentMap->getFieldNamesFlat( $document, ...
php
public function process(ContainerBuilder $container) { $this->documentMap = $container->get('graviton.document.map'); $map = []; foreach ($this->documentMap->getDocuments() as $document) { $restrictionFields = $this->documentMap->getFieldNamesFlat( $document, ...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "this", "->", "documentMap", "=", "$", "container", "->", "get", "(", "'graviton.document.map'", ")", ";", "$", "map", "=", "[", "]", ";", "foreach", "(", "$", "th...
prepare a map of base data restrictions for Restriction\Manager @param ContainerBuilder $container container builder @return void
[ "prepare", "a", "map", "of", "base", "data", "restrictions", "for", "Restriction", "\\", "Manager" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/RestrictionFieldsCompilerPass.php#L31-L58
26,319
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/Loader/Strategy/DirStrategy.php
DirStrategy.load
public function load($input) { return array_map( function (SplFileInfo $file) { return $file->getContents(); }, array_values(iterator_to_array($this->getFinder($input))) ); }
php
public function load($input) { return array_map( function (SplFileInfo $file) { return $file->getContents(); }, array_values(iterator_to_array($this->getFinder($input))) ); }
[ "public", "function", "load", "(", "$", "input", ")", "{", "return", "array_map", "(", "function", "(", "SplFileInfo", "$", "file", ")", "{", "return", "$", "file", "->", "getContents", "(", ")", ";", "}", ",", "array_values", "(", "iterator_to_array", "...
load raw JSON data @param string|null $input input from command @return string[]
[ "load", "raw", "JSON", "data" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/Loader/Strategy/DirStrategy.php#L37-L45
26,320
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/DocumentFieldNamesCompilerPass.php
DocumentFieldNamesCompilerPass.getFieldNames
private function getFieldNames(Document $document) { $result = []; foreach ($document->getFields() as $field) { $result[$field->getFieldName()] = $field->getExposedName(); } return $result; }
php
private function getFieldNames(Document $document) { $result = []; foreach ($document->getFields() as $field) { $result[$field->getFieldName()] = $field->getExposedName(); } return $result; }
[ "private", "function", "getFieldNames", "(", "Document", "$", "document", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "document", "->", "getFields", "(", ")", "as", "$", "field", ")", "{", "$", "result", "[", "$", "field", "->",...
Get field names @param Document $document Document @return array
[ "Get", "field", "names" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/DocumentFieldNamesCompilerPass.php#L49-L56
26,321
libgraviton/graviton
src/Graviton/GeneratorBundle/Composer/ScriptHandler.php
ScriptHandler.generateDynamicBundles
public static function generateDynamicBundles(Event $event) { $options = self::getOptions($event); $consolePath = $options['symfony-app-dir']; $cmd = escapeshellarg('graviton:generate:dynamicbundles').' --json'; self::executeCommand($event, $consolePath, $cmd); }
php
public static function generateDynamicBundles(Event $event) { $options = self::getOptions($event); $consolePath = $options['symfony-app-dir']; $cmd = escapeshellarg('graviton:generate:dynamicbundles').' --json'; self::executeCommand($event, $consolePath, $cmd); }
[ "public", "static", "function", "generateDynamicBundles", "(", "Event", "$", "event", ")", "{", "$", "options", "=", "self", "::", "getOptions", "(", "$", "event", ")", ";", "$", "consolePath", "=", "$", "options", "[", "'symfony-app-dir'", "]", ";", "$", ...
Generates dynamic bundles @param CommandEvent $event Event @return void
[ "Generates", "dynamic", "bundles" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Composer/ScriptHandler.php#L27-L34
26,322
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/Utils/ConstraintNormalizer.php
ConstraintNormalizer.normalize
public static function normalize(Constraint $constraint) { return [ 'name' => $constraint->getName(), 'options' => array_map( function (ConstraintOption $option) { return [ 'name' => $option->getName(), ...
php
public static function normalize(Constraint $constraint) { return [ 'name' => $constraint->getName(), 'options' => array_map( function (ConstraintOption $option) { return [ 'name' => $option->getName(), ...
[ "public", "static", "function", "normalize", "(", "Constraint", "$", "constraint", ")", "{", "return", "[", "'name'", "=>", "$", "constraint", "->", "getName", "(", ")", ",", "'options'", "=>", "array_map", "(", "function", "(", "ConstraintOption", "$", "opt...
Convert constraint to array to selerialile it via json_encode @param Constraint $constraint Constraint @return array
[ "Convert", "constraint", "to", "array", "to", "selerialile", "it", "via", "json_encode" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/Utils/ConstraintNormalizer.php#L25-L39
26,323
libgraviton/graviton
src/Graviton/LogBundle/Monolog/Processor/RequestIdProcessor.php
RequestIdProcessor.processRecord
public function processRecord(array $record) { if (is_null($this->requestId)) { $this->requestId = uniqid(''); } $record['extra']['requestId'] = $this->requestId; return $record; }
php
public function processRecord(array $record) { if (is_null($this->requestId)) { $this->requestId = uniqid(''); } $record['extra']['requestId'] = $this->requestId; return $record; }
[ "public", "function", "processRecord", "(", "array", "$", "record", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "requestId", ")", ")", "{", "$", "this", "->", "requestId", "=", "uniqid", "(", "''", ")", ";", "}", "$", "record", "[", "'e...
processes the record and adds a random request id @param array $record record @return array new record
[ "processes", "the", "record", "and", "adds", "a", "random", "request", "id" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/LogBundle/Monolog/Processor/RequestIdProcessor.php#L28-L37
26,324
libgraviton/graviton
src/Graviton/SecurityBundle/Authentication/Strategies/CookieFieldStrategy.php
CookieFieldStrategy.apply
public function apply(Request $request) { $bagValue = $this->extractFieldInfo($request->cookies, $this->field); // this needs to be available in a later state of the application $this->extractAdUsername($request, $bagValue); return $this->extractCoreId($request, $bagValue); }
php
public function apply(Request $request) { $bagValue = $this->extractFieldInfo($request->cookies, $this->field); // this needs to be available in a later state of the application $this->extractAdUsername($request, $bagValue); return $this->extractCoreId($request, $bagValue); }
[ "public", "function", "apply", "(", "Request", "$", "request", ")", "{", "$", "bagValue", "=", "$", "this", "->", "extractFieldInfo", "(", "$", "request", "->", "cookies", ",", "$", "this", "->", "field", ")", ";", "// this needs to be available in a later sta...
Applies the defined strategy on the provided request. Value may contain a coma separated string values, we use first as identifier. @param Request $request request to handle @return string
[ "Applies", "the", "defined", "strategy", "on", "the", "provided", "request", ".", "Value", "may", "contain", "a", "coma", "separated", "string", "values", "we", "use", "first", "as", "identifier", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Authentication/Strategies/CookieFieldStrategy.php#L52-L60
26,325
libgraviton/graviton
src/Graviton/SecurityBundle/Authentication/Strategies/CookieFieldStrategy.php
CookieFieldStrategy.extractAdUsername
protected function extractAdUsername(Request $request, $value) { $pattern = "/((?m)(?<=\b".self::COOKIE_FIELD_NAME."=)[^;]*)/i"; preg_match($pattern, $value, $matches); if ($matches) { $request->attributes->set(self::CONFIGURATION_PARAMETER_USER_ID, $matches[0]); re...
php
protected function extractAdUsername(Request $request, $value) { $pattern = "/((?m)(?<=\b".self::COOKIE_FIELD_NAME."=)[^;]*)/i"; preg_match($pattern, $value, $matches); if ($matches) { $request->attributes->set(self::CONFIGURATION_PARAMETER_USER_ID, $matches[0]); re...
[ "protected", "function", "extractAdUsername", "(", "Request", "$", "request", ",", "$", "value", ")", "{", "$", "pattern", "=", "\"/((?m)(?<=\\b\"", ".", "self", "::", "COOKIE_FIELD_NAME", ".", "\"=)[^;]*)/i\"", ";", "preg_match", "(", "$", "pattern", ",", "$"...
Finds and extracts the ad username from the cookie. @param Request $request Request stack that controls the lifecycle of requests @param string $value The string the value of self::COOKIE_FIELD_NAME shall be extracted from. @return string
[ "Finds", "and", "extracts", "the", "ad", "username", "from", "the", "cookie", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Authentication/Strategies/CookieFieldStrategy.php#L80-L92
26,326
libgraviton/graviton
src/Graviton/SecurityBundle/Authentication/Strategies/CookieFieldStrategy.php
CookieFieldStrategy.extractCoreId
protected function extractCoreId(Request $request, $text) { $pattern = "/((?m)(?<=\b".self::COOKIE_VALUE_CORE_ID."=)[^;]*)/i"; preg_match($pattern, $text, $matches); if ($matches) { $request->attributes->set(self::CONFIGURATION_PARAMETER_CORE_ID, $matches[0]); retur...
php
protected function extractCoreId(Request $request, $text) { $pattern = "/((?m)(?<=\b".self::COOKIE_VALUE_CORE_ID."=)[^;]*)/i"; preg_match($pattern, $text, $matches); if ($matches) { $request->attributes->set(self::CONFIGURATION_PARAMETER_CORE_ID, $matches[0]); retur...
[ "protected", "function", "extractCoreId", "(", "Request", "$", "request", ",", "$", "text", ")", "{", "$", "pattern", "=", "\"/((?m)(?<=\\b\"", ".", "self", "::", "COOKIE_VALUE_CORE_ID", ".", "\"=)[^;]*)/i\"", ";", "preg_match", "(", "$", "pattern", ",", "$", ...
Finds and extracts the core system id from tha cookie. @param Request $request Request stack that controls the lifecycle of requests @param string $text String to be examined for the core id. @return string
[ "Finds", "and", "extracts", "the", "core", "system", "id", "from", "tha", "cookie", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Authentication/Strategies/CookieFieldStrategy.php#L102-L114
26,327
libgraviton/graviton
src/Graviton/DocumentBundle/Entity/Translatable.php
Translatable.getDefaultLanguage
public static function getDefaultLanguage() { if (!is_null(self::$defaultLanguage)) { return self::$defaultLanguage; } if (!file_exists(self::$defaultLanguageFile)) { throw new \LogicException('Default language file '.self::$defaultLanguageFile.' does not exist'); ...
php
public static function getDefaultLanguage() { if (!is_null(self::$defaultLanguage)) { return self::$defaultLanguage; } if (!file_exists(self::$defaultLanguageFile)) { throw new \LogicException('Default language file '.self::$defaultLanguageFile.' does not exist'); ...
[ "public", "static", "function", "getDefaultLanguage", "(", ")", "{", "if", "(", "!", "is_null", "(", "self", "::", "$", "defaultLanguage", ")", ")", "{", "return", "self", "::", "$", "defaultLanguage", ";", "}", "if", "(", "!", "file_exists", "(", "self"...
returns the default language as statically generated in a file @return string default language
[ "returns", "the", "default", "language", "as", "statically", "generated", "in", "a", "file" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/Entity/Translatable.php#L60-L72
26,328
libgraviton/graviton
src/Graviton/SecurityBundle/Authentication/Strategies/MultiStrategy.php
MultiStrategy.apply
public function apply(Request $request) { foreach ($this->strategies as $strategy) { $name = $strategy->apply($request); if ($strategy->stopPropagation()) { $this->roles = $strategy->getRoles(); return $name; } } return fal...
php
public function apply(Request $request) { foreach ($this->strategies as $strategy) { $name = $strategy->apply($request); if ($strategy->stopPropagation()) { $this->roles = $strategy->getRoles(); return $name; } } return fal...
[ "public", "function", "apply", "(", "Request", "$", "request", ")", "{", "foreach", "(", "$", "this", "->", "strategies", "as", "$", "strategy", ")", "{", "$", "name", "=", "$", "strategy", "->", "apply", "(", "$", "request", ")", ";", "if", "(", "...
Applies the defined strategies on the provided request. @param Request $request request to handle @return string
[ "Applies", "the", "defined", "strategies", "on", "the", "provided", "request", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Authentication/Strategies/MultiStrategy.php#L45-L56
26,329
libgraviton/graviton
src/Graviton/RestBundle/Restriction/Handler/Whoami.php
Whoami.getValue
public function getValue(DocumentRepository $repository, $fieldPath) { $user = 'anonymous'; $securityUser = $this->securityUtils->getSecurityUser(); if ($securityUser instanceof SecurityUser) { $user = trim(strtolower($securityUser->getUsername())); } return $us...
php
public function getValue(DocumentRepository $repository, $fieldPath) { $user = 'anonymous'; $securityUser = $this->securityUtils->getSecurityUser(); if ($securityUser instanceof SecurityUser) { $user = trim(strtolower($securityUser->getUsername())); } return $us...
[ "public", "function", "getValue", "(", "DocumentRepository", "$", "repository", ",", "$", "fieldPath", ")", "{", "$", "user", "=", "'anonymous'", ";", "$", "securityUser", "=", "$", "this", "->", "securityUtils", "->", "getSecurityUser", "(", ")", ";", "if",...
gets the actual value or an AbstractQueryNode that is used to filter the data. @param DocumentRepository $repository the repository @param string $fieldPath field path @return string|AbstractQueryNode string for eq() filtering or a AbstractQueryNode instance
[ "gets", "the", "actual", "value", "or", "an", "AbstractQueryNode", "that", "is", "used", "to", "filter", "the", "data", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Restriction/Handler/Whoami.php#L52-L62
26,330
libgraviton/graviton
src/Graviton/RestBundle/Serializer/ContextFactoryAbstract.php
ContextFactoryAbstract.workOnInstance
protected function workOnInstance(Context $context) { $context = $context->setSerializeNull($this->setSerializeNull); // group override? if (true === $this->overrideHeaderAllowed && $this->requestStack instanceof RequestStack && $this->requestStack->getCurrentRequest...
php
protected function workOnInstance(Context $context) { $context = $context->setSerializeNull($this->setSerializeNull); // group override? if (true === $this->overrideHeaderAllowed && $this->requestStack instanceof RequestStack && $this->requestStack->getCurrentRequest...
[ "protected", "function", "workOnInstance", "(", "Context", "$", "context", ")", "{", "$", "context", "=", "$", "context", "->", "setSerializeNull", "(", "$", "this", "->", "setSerializeNull", ")", ";", "// group override?", "if", "(", "true", "===", "$", "th...
sets the necessary properties on the context @param Context $context context @return Context context
[ "sets", "the", "necessary", "properties", "on", "the", "context" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Serializer/ContextFactoryAbstract.php#L131-L156
26,331
libgraviton/graviton
src/Graviton/GeneratorBundle/DependencyInjection/Compiler/GeneratorHashCompilerPass.php
GeneratorHashCompilerPass.process
public function process(ContainerBuilder $container) { // first type of hash: the genhash'es of all GravitonDyn bundles $dir = $container->getParameter('graviton.generator.dynamicbundle.dir'); $dynHash = ''; if (is_dir($dir)) { $finder = (new Finder()) ->...
php
public function process(ContainerBuilder $container) { // first type of hash: the genhash'es of all GravitonDyn bundles $dir = $container->getParameter('graviton.generator.dynamicbundle.dir'); $dynHash = ''; if (is_dir($dir)) { $finder = (new Finder()) ->...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "// first type of hash: the genhash'es of all GravitonDyn bundles", "$", "dir", "=", "$", "container", "->", "getParameter", "(", "'graviton.generator.dynamicbundle.dir'", ")", ";", "$", ...
generate the hashes @param ContainerBuilder $container container builder @return void
[ "generate", "the", "hashes" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/DependencyInjection/Compiler/GeneratorHashCompilerPass.php#L27-L71
26,332
libgraviton/graviton
src/Graviton/GeneratorBundle/Generator/DynamicBundleBundleGenerator.php
DynamicBundleBundleGenerator.generate
public function generate(array $bundleList, $bundleBundleNamespace, $bundleName, $targetFilename) { $absoluteList = []; foreach ($bundleList as $namespace) { $absoluteList[] = '\\' . str_replace('/', '\\', $namespace) . '\\' . str_replace('/', '', $namespace); } ...
php
public function generate(array $bundleList, $bundleBundleNamespace, $bundleName, $targetFilename) { $absoluteList = []; foreach ($bundleList as $namespace) { $absoluteList[] = '\\' . str_replace('/', '\\', $namespace) . '\\' . str_replace('/', '', $namespace); } ...
[ "public", "function", "generate", "(", "array", "$", "bundleList", ",", "$", "bundleBundleNamespace", ",", "$", "bundleName", ",", "$", "targetFilename", ")", "{", "$", "absoluteList", "=", "[", "]", ";", "foreach", "(", "$", "bundleList", "as", "$", "name...
Generate the BundleBundle @param array $bundleList List of bundles @param string $bundleBundleNamespace Namespace of our BundleBundle @param string $bundleName Name of the bundle @param string $targetFilename Where to write the list to @return void
[ "Generate", "the", "BundleBundle" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Generator/DynamicBundleBundleGenerator.php#L47-L69
26,333
libgraviton/graviton
src/Graviton/CacheBundle/Listener/IfNoneMatchResponseListener.php
IfNoneMatchResponseListener.onKernelResponse
public function onKernelResponse(FilterResponseEvent $event) { $response = $event->getResponse(); $request = $event->getRequest(); $ifNoneMatch = $request->headers->get('if-none-match'); $etag = $response->headers->get('ETag', 'empty'); if ($ifNoneMatch === $etag) { ...
php
public function onKernelResponse(FilterResponseEvent $event) { $response = $event->getResponse(); $request = $event->getRequest(); $ifNoneMatch = $request->headers->get('if-none-match'); $etag = $response->headers->get('ETag', 'empty'); if ($ifNoneMatch === $etag) { ...
[ "public", "function", "onKernelResponse", "(", "FilterResponseEvent", "$", "event", ")", "{", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ";", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "ifNoneMatch", ...
add a IfNoneMatch header to the response @param FilterResponseEvent $event response listener event @return void
[ "add", "a", "IfNoneMatch", "header", "to", "the", "response" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/CacheBundle/Listener/IfNoneMatchResponseListener.php#L26-L38
26,334
libgraviton/graviton
src/Graviton/CoreBundle/Compiler/HttpClientOptionsCompilerPass.php
HttpClientOptionsCompilerPass.process
public function process(ContainerBuilder $container) { $baseOptions = [ 'verify' => false ]; // system settings envs if (isset($_ENV['HTTP_PROXY']) && !empty($_ENV['HTTP_PROXY'])) { $this->setProxy($_ENV['HTTP_PROXY'], 'http'); } if (isset($_E...
php
public function process(ContainerBuilder $container) { $baseOptions = [ 'verify' => false ]; // system settings envs if (isset($_ENV['HTTP_PROXY']) && !empty($_ENV['HTTP_PROXY'])) { $this->setProxy($_ENV['HTTP_PROXY'], 'http'); } if (isset($_E...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "baseOptions", "=", "[", "'verify'", "=>", "false", "]", ";", "// system settings envs", "if", "(", "isset", "(", "$", "_ENV", "[", "'HTTP_PROXY'", "]", ")", "&&", "...
add guzzle options @param ContainerBuilder $container Container @return void
[ "add", "guzzle", "options" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/CoreBundle/Compiler/HttpClientOptionsCompilerPass.php#L32-L77
26,335
libgraviton/graviton
src/Graviton/CoreBundle/Compiler/HttpClientOptionsCompilerPass.php
HttpClientOptionsCompilerPass.setProxy
private function setProxy($proxy, $onlyProtocol = null) { $proxy = trim($proxy); if (null == $onlyProtocol) { $this->proxySettings['http'] = $proxy; $this->proxySettings['https'] = $proxy; } else { $this->proxySettings[$onlyProtocol] = $proxy; } ...
php
private function setProxy($proxy, $onlyProtocol = null) { $proxy = trim($proxy); if (null == $onlyProtocol) { $this->proxySettings['http'] = $proxy; $this->proxySettings['https'] = $proxy; } else { $this->proxySettings[$onlyProtocol] = $proxy; } ...
[ "private", "function", "setProxy", "(", "$", "proxy", ",", "$", "onlyProtocol", "=", "null", ")", "{", "$", "proxy", "=", "trim", "(", "$", "proxy", ")", ";", "if", "(", "null", "==", "$", "onlyProtocol", ")", "{", "$", "this", "->", "proxySettings",...
set the proxy @param string $proxy the proxy @param null|boolean $onlyProtocol only set certain protocol @return void
[ "set", "the", "proxy" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/CoreBundle/Compiler/HttpClientOptionsCompilerPass.php#L87-L96
26,336
libgraviton/graviton
src/Graviton/CoreBundle/Compiler/HttpClientOptionsCompilerPass.php
HttpClientOptionsCompilerPass.setNoProxyList
private function setNoProxyList($list) { if (is_array($list)) { $this->proxySettings['no'] = array_map('trim', $list); return; } if (is_string($list) && strpos($list, ',') !== false) { $this->proxySettings['no'] = explode(',', $list); } elseif (is...
php
private function setNoProxyList($list) { if (is_array($list)) { $this->proxySettings['no'] = array_map('trim', $list); return; } if (is_string($list) && strpos($list, ',') !== false) { $this->proxySettings['no'] = explode(',', $list); } elseif (is...
[ "private", "function", "setNoProxyList", "(", "$", "list", ")", "{", "if", "(", "is_array", "(", "$", "list", ")", ")", "{", "$", "this", "->", "proxySettings", "[", "'no'", "]", "=", "array_map", "(", "'trim'", ",", "$", "list", ")", ";", "return", ...
set the no proxy setting @param string $list either string or array @return void
[ "set", "the", "no", "proxy", "setting" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/CoreBundle/Compiler/HttpClientOptionsCompilerPass.php#L105-L118
26,337
libgraviton/graviton
src/Graviton/SchemaBundle/Serializer/Handler/SchemaAdditionalPropertiesHandler.php
SchemaAdditionalPropertiesHandler.serializeSchemaAdditionalPropertiesToJson
public function serializeSchemaAdditionalPropertiesToJson( JsonSerializationVisitor $visitor, SchemaAdditionalProperties $additionalProperties, array $type, Context $context ) { $properties = $additionalProperties->getProperties(); // case for v4 schema if (...
php
public function serializeSchemaAdditionalPropertiesToJson( JsonSerializationVisitor $visitor, SchemaAdditionalProperties $additionalProperties, array $type, Context $context ) { $properties = $additionalProperties->getProperties(); // case for v4 schema if (...
[ "public", "function", "serializeSchemaAdditionalPropertiesToJson", "(", "JsonSerializationVisitor", "$", "visitor", ",", "SchemaAdditionalProperties", "$", "additionalProperties", ",", "array", "$", "type", ",", "Context", "$", "context", ")", "{", "$", "properties", "=...
Serialize additionalProperties to JSON @param JsonSerializationVisitor $visitor Visitor @param SchemaAdditionalProperties $additionalProperties properties @param array $type Type @param Context $context Context @return string|null
[ "Serialize", "additionalProperties", "to", "JSON" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Serializer/Handler/SchemaAdditionalPropertiesHandler.php#L33-L55
26,338
libgraviton/graviton
src/Graviton/AnalyticsBundle/Manager/ServiceManager.php
ServiceManager.getServices
public function getServices() { $services = $this->cacheProvider->fetch(self::CACHE_KEY_SERVICES_URLS); if (is_array($services)) { return $services; } $services = []; foreach ($this->analyticsServices as $name => $service) { if (is_numeric($name)) { ...
php
public function getServices() { $services = $this->cacheProvider->fetch(self::CACHE_KEY_SERVICES_URLS); if (is_array($services)) { return $services; } $services = []; foreach ($this->analyticsServices as $name => $service) { if (is_numeric($name)) { ...
[ "public", "function", "getServices", "(", ")", "{", "$", "services", "=", "$", "this", "->", "cacheProvider", "->", "fetch", "(", "self", "::", "CACHE_KEY_SERVICES_URLS", ")", ";", "if", "(", "is_array", "(", "$", "services", ")", ")", "{", "return", "$"...
Return array of available services @return array
[ "Return", "array", "of", "available", "services" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Manager/ServiceManager.php#L107-L143
26,339
libgraviton/graviton
src/Graviton/AnalyticsBundle/Manager/ServiceManager.php
ServiceManager.getData
public function getData() { $serviceRoute = $this->requestStack->getCurrentRequest() ->get('service'); // Locate the model definition $model = $this->getAnalyticModel($serviceRoute); $cacheTime = $model->getCacheTime(); $cacheKey =...
php
public function getData() { $serviceRoute = $this->requestStack->getCurrentRequest() ->get('service'); // Locate the model definition $model = $this->getAnalyticModel($serviceRoute); $cacheTime = $model->getCacheTime(); $cacheKey =...
[ "public", "function", "getData", "(", ")", "{", "$", "serviceRoute", "=", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(", ")", "->", "get", "(", "'service'", ")", ";", "// Locate the model definition", "$", "model", "=", "$", "this", "->",...
Will map and find data for defined route @return array
[ "Will", "map", "and", "find", "data", "for", "defined", "route" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Manager/ServiceManager.php#L169-L195
26,340
libgraviton/graviton
src/Graviton/AnalyticsBundle/Manager/ServiceManager.php
ServiceManager.getCacheKey
private function getCacheKey($schema) { return self::CACHE_KEY_SERVICES_PREFIX . $schema->getRoute() . sha1(serialize($this->requestStack->getCurrentRequest()->query->all())); }
php
private function getCacheKey($schema) { return self::CACHE_KEY_SERVICES_PREFIX . $schema->getRoute() . sha1(serialize($this->requestStack->getCurrentRequest()->query->all())); }
[ "private", "function", "getCacheKey", "(", "$", "schema", ")", "{", "return", "self", "::", "CACHE_KEY_SERVICES_PREFIX", ".", "$", "schema", "->", "getRoute", "(", ")", ".", "sha1", "(", "serialize", "(", "$", "this", "->", "requestStack", "->", "getCurrentR...
generate a cache key also based on query @param AnalyticModel $schema schema @return string cache key
[ "generate", "a", "cache", "key", "also", "based", "on", "query" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Manager/ServiceManager.php#L204-L209
26,341
libgraviton/graviton
src/Graviton/AnalyticsBundle/Manager/ServiceManager.php
ServiceManager.getSchema
public function getSchema() { $serviceRoute = $this->requestStack->getCurrentRequest() ->get('service'); // Locate the schema definition $model = $this->getAnalyticModel($serviceRoute); return $model->getSchema(); }
php
public function getSchema() { $serviceRoute = $this->requestStack->getCurrentRequest() ->get('service'); // Locate the schema definition $model = $this->getAnalyticModel($serviceRoute); return $model->getSchema(); }
[ "public", "function", "getSchema", "(", ")", "{", "$", "serviceRoute", "=", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(", ")", "->", "get", "(", "'service'", ")", ";", "// Locate the schema definition", "$", "model", "=", "$", "this", "-...
Locate and display service definition schema @return mixed
[ "Locate", "and", "display", "service", "definition", "schema" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Manager/ServiceManager.php#L216-L225
26,342
libgraviton/graviton
src/Graviton/AnalyticsBundle/Manager/ServiceManager.php
ServiceManager.getServiceParameters
private function getServiceParameters(AnalyticModel $model) { $params = []; if (!is_array($model->getParams())) { return $params; } foreach ($model->getParams() as $param) { if (!isset($param['name'])) { throw new \LogicException("Incorrect sp...
php
private function getServiceParameters(AnalyticModel $model) { $params = []; if (!is_array($model->getParams())) { return $params; } foreach ($model->getParams() as $param) { if (!isset($param['name'])) { throw new \LogicException("Incorrect sp...
[ "private", "function", "getServiceParameters", "(", "AnalyticModel", "$", "model", ")", "{", "$", "params", "=", "[", "]", ";", "if", "(", "!", "is_array", "(", "$", "model", "->", "getParams", "(", ")", ")", ")", "{", "return", "$", "params", ";", "...
returns the params as passed from the user @param AnalyticModel $model model @return array the params, converted as specified @throws AnalyticUsageException
[ "returns", "the", "params", "as", "passed", "from", "the", "user" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Manager/ServiceManager.php#L235-L305
26,343
libgraviton/graviton
src/Graviton/RestBundle/GravitonRestBundle.php
GravitonRestBundle.build
public function build(ContainerBuilder $container) { parent::build($container); $container->addCompilerPass(new RestServicesCompilerPass); $container->addCompilerPass(new RqlQueryRoutesCompilerPass()); }
php
public function build(ContainerBuilder $container) { parent::build($container); $container->addCompilerPass(new RestServicesCompilerPass); $container->addCompilerPass(new RqlQueryRoutesCompilerPass()); }
[ "public", "function", "build", "(", "ContainerBuilder", "$", "container", ")", "{", "parent", "::", "build", "(", "$", "container", ")", ";", "$", "container", "->", "addCompilerPass", "(", "new", "RestServicesCompilerPass", ")", ";", "$", "container", "->", ...
load compiler pass rest route loader @param ContainerBuilder $container container builder @return void
[ "load", "compiler", "pass", "rest", "route", "loader" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/GravitonRestBundle.php#L47-L53
26,344
libgraviton/graviton
src/Graviton/RestBundle/Listener/JsonRequestListener.php
JsonRequestListener.onKernelRequest
public function onKernelRequest(RestEvent $event) { $request = $event->getRequest(); if ($request->headers->has('Accept')) { $format = $request->getFormat($request->headers->get('Accept')); if (!empty($format)) { $request->setRequestFormat($format); ...
php
public function onKernelRequest(RestEvent $event) { $request = $event->getRequest(); if ($request->headers->has('Accept')) { $format = $request->getFormat($request->headers->get('Accept')); if (!empty($format)) { $request->setRequestFormat($format); ...
[ "public", "function", "onKernelRequest", "(", "RestEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "$", "request", "->", "headers", "->", "has", "(", "'Accept'", ")", ")", "{", "$", "fo...
Validate the json input to prevent errors in the following components @param RestEvent $event Event @return void|null
[ "Validate", "the", "json", "input", "to", "prevent", "errors", "in", "the", "following", "components" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/JsonRequestListener.php#L24-L36
26,345
libgraviton/graviton
src/Graviton/RestBundle/Subscriber/RestEventSubscriber.php
RestEventSubscriber.onKernelRequest
public function onKernelRequest(GetResponseEvent $event, $name, EventDispatcherInterface $dispatcher) { $restEvent = $this->getEventObject($event); if ($restEvent instanceof RestEvent) { $dispatcher->dispatch("graviton.rest.request", $restEvent); } }
php
public function onKernelRequest(GetResponseEvent $event, $name, EventDispatcherInterface $dispatcher) { $restEvent = $this->getEventObject($event); if ($restEvent instanceof RestEvent) { $dispatcher->dispatch("graviton.rest.request", $restEvent); } }
[ "public", "function", "onKernelRequest", "(", "GetResponseEvent", "$", "event", ",", "$", "name", ",", "EventDispatcherInterface", "$", "dispatcher", ")", "{", "$", "restEvent", "=", "$", "this", "->", "getEventObject", "(", "$", "event", ")", ";", "if", "("...
Handler for kernel.request events @param GetResponseEvent $event Event @param string $name Event name @param EventDispatcherInterface $dispatcher Event dispatcher @return void
[ "Handler", "for", "kernel", ".", "request", "events" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Subscriber/RestEventSubscriber.php#L82-L88
26,346
libgraviton/graviton
src/Graviton/RestBundle/Subscriber/RestEventSubscriber.php
RestEventSubscriber.getEventObject
private function getEventObject(Event $event) { // get the service name list ($serviceName) = explode(":", $event->getRequest()->get('_controller')); // get the controller which handles this request if ($this->container->has($serviceName)) { $controller = $this->containe...
php
private function getEventObject(Event $event) { // get the service name list ($serviceName) = explode(":", $event->getRequest()->get('_controller')); // get the controller which handles this request if ($this->container->has($serviceName)) { $controller = $this->containe...
[ "private", "function", "getEventObject", "(", "Event", "$", "event", ")", "{", "// get the service name", "list", "(", "$", "serviceName", ")", "=", "explode", "(", "\":\"", ",", "$", "event", "->", "getRequest", "(", ")", "->", "get", "(", "'_controller'", ...
Get a RestEvent object -> put this in a factory @param Event $event Original event (kernel.request / kernel.response) @return RestEvent $restEvent
[ "Get", "a", "RestEvent", "object", "-", ">", "put", "this", "in", "a", "factory" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Subscriber/RestEventSubscriber.php#L97-L116
26,347
libgraviton/graviton
src/Graviton/ProxyBundle/Definition/ApiDefinition.php
ApiDefinition.hasEndpoint
public function hasEndpoint($endpoint) { $retVal = false; if (isset($this->endpoints)) { $retVal = in_array($endpoint, $this->endpoints); } return $retVal; }
php
public function hasEndpoint($endpoint) { $retVal = false; if (isset($this->endpoints)) { $retVal = in_array($endpoint, $this->endpoints); } return $retVal; }
[ "public", "function", "hasEndpoint", "(", "$", "endpoint", ")", "{", "$", "retVal", "=", "false", ";", "if", "(", "isset", "(", "$", "this", "->", "endpoints", ")", ")", "{", "$", "retVal", "=", "in_array", "(", "$", "endpoint", ",", "$", "this", "...
check if an endpoint exists @param string $endpoint endpoint @return boolean
[ "check", "if", "an", "endpoint", "exists" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Definition/ApiDefinition.php#L127-L135
26,348
libgraviton/graviton
src/Graviton/ProxyBundle/Definition/ApiDefinition.php
ApiDefinition.getEndpoints
public function getEndpoints($withHost = true, $prefix = null, $host = '', $withBasePath = true) { $endpoints = []; $basePath = ""; if ($withHost) { $basePath = (empty($host)) ? $this->getHost() : $host; } if (!empty($prefix)) { $basePath .= $prefix; ...
php
public function getEndpoints($withHost = true, $prefix = null, $host = '', $withBasePath = true) { $endpoints = []; $basePath = ""; if ($withHost) { $basePath = (empty($host)) ? $this->getHost() : $host; } if (!empty($prefix)) { $basePath .= $prefix; ...
[ "public", "function", "getEndpoints", "(", "$", "withHost", "=", "true", ",", "$", "prefix", "=", "null", ",", "$", "host", "=", "''", ",", "$", "withBasePath", "=", "true", ")", "{", "$", "endpoints", "=", "[", "]", ";", "$", "basePath", "=", "\"\...
get all defined API endpoints @param boolean $withHost url with hostname @param string $prefix add a prefix to the url (blub/endpoint/url) @param string $host Host to be used instead of the host defined in the swagger json @param bool $withBasePath Defines whether the API's base path should be i...
[ "get", "all", "defined", "API", "endpoints" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Definition/ApiDefinition.php#L147-L165
26,349
libgraviton/graviton
src/Graviton/ProxyBundle/Definition/ApiDefinition.php
ApiDefinition.getSchema
public function getSchema($endpoint) { //remove base path if ('/' !== $this->basePath) { $endpoint = str_replace($this->basePath, '', $endpoint); } $retVal = new \stdClass(); if (array_key_exists($endpoint, $this->schemes)) { $retVal = $this->schemes[$...
php
public function getSchema($endpoint) { //remove base path if ('/' !== $this->basePath) { $endpoint = str_replace($this->basePath, '', $endpoint); } $retVal = new \stdClass(); if (array_key_exists($endpoint, $this->schemes)) { $retVal = $this->schemes[$...
[ "public", "function", "getSchema", "(", "$", "endpoint", ")", "{", "//remove base path", "if", "(", "'/'", "!==", "$", "this", "->", "basePath", ")", "{", "$", "endpoint", "=", "str_replace", "(", "$", "this", "->", "basePath", ",", "''", ",", "$", "en...
get a schema for an endpoint @param string $endpoint endpoint @return \stdClass
[ "get", "a", "schema", "for", "an", "endpoint" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Definition/ApiDefinition.php#L187-L199
26,350
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.hasController
public function hasController() { return $this->def->getService() !== null && $this->def->getService()->getRouterBase() !== null; }
php
public function hasController() { return $this->def->getService() !== null && $this->def->getService()->getRouterBase() !== null; }
[ "public", "function", "hasController", "(", ")", "{", "return", "$", "this", "->", "def", "->", "getService", "(", ")", "!==", "null", "&&", "$", "this", "->", "def", "->", "getService", "(", ")", "->", "getRouterBase", "(", ")", "!==", "null", ";", ...
Returns whether this definition requires the generation of a controller. normally yes, but sometimes not ;-) @return bool true if yes, false if no
[ "Returns", "whether", "this", "definition", "requires", "the", "generation", "of", "a", "controller", ".", "normally", "yes", "but", "sometimes", "not", ";", "-", ")" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L94-L98
26,351
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.isReadOnlyService
public function isReadOnlyService() { if ($this->def->getService() === null) { return false; } return $this->def->getService()->getReadOnly(); }
php
public function isReadOnlyService() { if ($this->def->getService() === null) { return false; } return $this->def->getService()->getReadOnly(); }
[ "public", "function", "isReadOnlyService", "(", ")", "{", "if", "(", "$", "this", "->", "def", "->", "getService", "(", ")", "===", "null", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "def", "->", "getService", "(", ")", "->",...
Returns whether this service is read-only @return bool true if yes, false if not
[ "Returns", "whether", "this", "service", "is", "read", "-", "only" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L147-L154
26,352
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.isVersionedService
public function isVersionedService() { if ($this->def->getService() === null || !$this->def->getService()->getVersioning()) { return false; } return (boolean) $this->def->getService()->getVersioning(); }
php
public function isVersionedService() { if ($this->def->getService() === null || !$this->def->getService()->getVersioning()) { return false; } return (boolean) $this->def->getService()->getVersioning(); }
[ "public", "function", "isVersionedService", "(", ")", "{", "if", "(", "$", "this", "->", "def", "->", "getService", "(", ")", "===", "null", "||", "!", "$", "this", "->", "def", "->", "getService", "(", ")", "->", "getVersioning", "(", ")", ")", "{",...
Returns whether this service is versioning @return bool true if yes, false if not
[ "Returns", "whether", "this", "service", "is", "versioning" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L161-L168
26,353
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.getRouterBase
public function getRouterBase() { if ($this->def->getService() === null || $this->def->getService()->getRouterBase() === null) { return false; } $routerBase = $this->def->getService()->getRouterBase(); if (substr($routerBase, 0, 1) !== '/') { $rou...
php
public function getRouterBase() { if ($this->def->getService() === null || $this->def->getService()->getRouterBase() === null) { return false; } $routerBase = $this->def->getService()->getRouterBase(); if (substr($routerBase, 0, 1) !== '/') { $rou...
[ "public", "function", "getRouterBase", "(", ")", "{", "if", "(", "$", "this", "->", "def", "->", "getService", "(", ")", "===", "null", "||", "$", "this", "->", "def", "->", "getService", "(", ")", "->", "getRouterBase", "(", ")", "===", "null", ")",...
Returns a router base path. false if default should be used. @return string router base, i.e. /bundle/name/
[ "Returns", "a", "router", "base", "path", ".", "false", "if", "default", "should", "be", "used", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L215-L231
26,354
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.getBaseController
public function getBaseController() { if ($this->def->getService() === null || $this->def->getService()->getBaseController() === null) { return 'RestController'; } return $this->def->getService()->getBaseController(); }
php
public function getBaseController() { if ($this->def->getService() === null || $this->def->getService()->getBaseController() === null) { return 'RestController'; } return $this->def->getService()->getBaseController(); }
[ "public", "function", "getBaseController", "(", ")", "{", "if", "(", "$", "this", "->", "def", "->", "getService", "(", ")", "===", "null", "||", "$", "this", "->", "def", "->", "getService", "(", ")", "->", "getBaseController", "(", ")", "===", "null"...
Returns the Controller classname this services' controller shout inherit. Defaults to the RestController of the RestBundle of course. @return string base controller
[ "Returns", "the", "Controller", "classname", "this", "services", "controller", "shout", "inherit", ".", "Defaults", "to", "the", "RestController", "of", "the", "RestBundle", "of", "course", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L239-L247
26,355
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.getParentService
public function getParentService() { if ($this->def->getService() === null || $this->def->getService()->getParent() === null) { return 'graviton.rest.controller'; } return $this->def->getService()->getParent(); }
php
public function getParentService() { if ($this->def->getService() === null || $this->def->getService()->getParent() === null) { return 'graviton.rest.controller'; } return $this->def->getService()->getParent(); }
[ "public", "function", "getParentService", "(", ")", "{", "if", "(", "$", "this", "->", "def", "->", "getService", "(", ")", "===", "null", "||", "$", "this", "->", "def", "->", "getService", "(", ")", "->", "getParent", "(", ")", "===", "null", ")", ...
Returns the parent service to use when adding the service xml Defaults to graviton.rest.controller @return string base controller
[ "Returns", "the", "parent", "service", "to", "use", "when", "adding", "the", "service", "xml" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L256-L264
26,356
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.getFields
public function getFields() { $hierarchy = []; foreach ($this->def->getTarget()->getFields() as $field) { $hierarchy = array_merge_recursive( $hierarchy, $this->createFieldHierarchyRecursive($field, $field->getName()) ); } $fie...
php
public function getFields() { $hierarchy = []; foreach ($this->def->getTarget()->getFields() as $field) { $hierarchy = array_merge_recursive( $hierarchy, $this->createFieldHierarchyRecursive($field, $field->getName()) ); } $fie...
[ "public", "function", "getFields", "(", ")", "{", "$", "hierarchy", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "def", "->", "getTarget", "(", ")", "->", "getFields", "(", ")", "as", "$", "field", ")", "{", "$", "hierarchy", "=", "array_...
Returns the field definition @return DefinitionElementInterface[] Fields
[ "Returns", "the", "field", "definition" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L284-L323
26,357
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.getRelations
public function getRelations() { if ($this->def->getTarget() === null) { return []; } $relations = []; foreach ($this->def->getTarget()->getRelations() as $relation) { $relations[$relation->getLocalProperty()] = $relation; } return $relations...
php
public function getRelations() { if ($this->def->getTarget() === null) { return []; } $relations = []; foreach ($this->def->getTarget()->getRelations() as $relation) { $relations[$relation->getLocalProperty()] = $relation; } return $relations...
[ "public", "function", "getRelations", "(", ")", "{", "if", "(", "$", "this", "->", "def", "->", "getTarget", "(", ")", "===", "null", ")", "{", "return", "[", "]", ";", "}", "$", "relations", "=", "[", "]", ";", "foreach", "(", "$", "this", "->",...
Get target relations which are explictly defined @return Schema\Relation[] relations
[ "Get", "target", "relations", "which", "are", "explictly", "defined" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L408-L420
26,358
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.getRelation
private function getRelation($field) { $relations = $this->getRelations(); return isset($relations[$field]) ? $relations[$field] : null; }
php
private function getRelation($field) { $relations = $this->getRelations(); return isset($relations[$field]) ? $relations[$field] : null; }
[ "private", "function", "getRelation", "(", "$", "field", ")", "{", "$", "relations", "=", "$", "this", "->", "getRelations", "(", ")", ";", "return", "isset", "(", "$", "relations", "[", "$", "field", "]", ")", "?", "$", "relations", "[", "$", "field...
Get relation by field name @param string $field Field name @return Schema\Relation|null
[ "Get", "relation", "by", "field", "name" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L428-L432
26,359
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.getSolrFields
public function getSolrFields() { $solr = $this->def->getSolr(); if (!$solr instanceof Solr) { return []; } $fields = []; foreach ($solr->getFields() as $field) { $fields[] = [ 'name' => $field->getName(), 'type' => $fi...
php
public function getSolrFields() { $solr = $this->def->getSolr(); if (!$solr instanceof Solr) { return []; } $fields = []; foreach ($solr->getFields() as $field) { $fields[] = [ 'name' => $field->getName(), 'type' => $fi...
[ "public", "function", "getSolrFields", "(", ")", "{", "$", "solr", "=", "$", "this", "->", "def", "->", "getSolr", "(", ")", ";", "if", "(", "!", "$", "solr", "instanceof", "Solr", ")", "{", "return", "[", "]", ";", "}", "$", "fields", "=", "[", ...
gets information about solr @return array|Schema\Solr
[ "gets", "information", "about", "solr" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L467-L484
26,360
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.isRecordOriginModifiable
public function isRecordOriginModifiable() { $retVal = false; if ($this->isRecordOriginFlagSet()) { $retVal = $this->def->getService()->getRecordOriginModifiable(); } return $retVal; }
php
public function isRecordOriginModifiable() { $retVal = false; if ($this->isRecordOriginFlagSet()) { $retVal = $this->def->getService()->getRecordOriginModifiable(); } return $retVal; }
[ "public", "function", "isRecordOriginModifiable", "(", ")", "{", "$", "retVal", "=", "false", ";", "if", "(", "$", "this", "->", "isRecordOriginFlagSet", "(", ")", ")", "{", "$", "retVal", "=", "$", "this", "->", "def", "->", "getService", "(", ")", "-...
Can record origin be modified @return bool
[ "Can", "record", "origin", "be", "modified" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L505-L513
26,361
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinition.php
JsonDefinition.isRecordOriginFlagSet
public function isRecordOriginFlagSet() { $retVal = false; if ($this->def->getService() !== null && is_object($this->def->getService()) && $this->def->getService()->getRecordOriginModifiable() !== null) { $retVal = true; } return $retVal; }
php
public function isRecordOriginFlagSet() { $retVal = false; if ($this->def->getService() !== null && is_object($this->def->getService()) && $this->def->getService()->getRecordOriginModifiable() !== null) { $retVal = true; } return $retVal; }
[ "public", "function", "isRecordOriginFlagSet", "(", ")", "{", "$", "retVal", "=", "false", ";", "if", "(", "$", "this", "->", "def", "->", "getService", "(", ")", "!==", "null", "&&", "is_object", "(", "$", "this", "->", "def", "->", "getService", "(",...
check if the RecordOriginModifiable flag is set @return bool
[ "check", "if", "the", "RecordOriginModifiable", "flag", "is", "set" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinition.php#L520-L530
26,362
libgraviton/graviton
src/Graviton/DocumentBundle/Serializer/Handler/DateHandler.php
DateHandler.deserializeDateTimeFromJson
public function deserializeDateTimeFromJson(JsonDeserializationVisitor $visitor, $data, array $type) { if (null === $data) { return null; } return parent::deserializeDateTimeFromJson( $visitor, $this->dateConverter->getDateTimeStringInFormat($data), ...
php
public function deserializeDateTimeFromJson(JsonDeserializationVisitor $visitor, $data, array $type) { if (null === $data) { return null; } return parent::deserializeDateTimeFromJson( $visitor, $this->dateConverter->getDateTimeStringInFormat($data), ...
[ "public", "function", "deserializeDateTimeFromJson", "(", "JsonDeserializationVisitor", "$", "visitor", ",", "$", "data", ",", "array", "$", "type", ")", "{", "if", "(", "null", "===", "$", "data", ")", "{", "return", "null", ";", "}", "return", "parent", ...
serialize datetime from json @param JsonDeserializationVisitor $visitor visitor @param string $data data @param array $type type @return \DateTime|null DateTime instance
[ "serialize", "datetime", "from", "json" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/Serializer/Handler/DateHandler.php#L71-L82
26,363
libgraviton/graviton
src/Graviton/DocumentBundle/Serializer/Handler/DateHandler.php
DateHandler.serializeDateTime
public function serializeDateTime(VisitorInterface $visitor, \DateTime $date, array $type, Context $context) { return $visitor->visitString($this->dateConverter->formatDateTime($date), $type, $context); }
php
public function serializeDateTime(VisitorInterface $visitor, \DateTime $date, array $type, Context $context) { return $visitor->visitString($this->dateConverter->formatDateTime($date), $type, $context); }
[ "public", "function", "serializeDateTime", "(", "VisitorInterface", "$", "visitor", ",", "\\", "DateTime", "$", "date", ",", "array", "$", "type", ",", "Context", "$", "context", ")", "{", "return", "$", "visitor", "->", "visitString", "(", "$", "this", "-...
serialize datetime to json @param VisitorInterface $visitor visitor @param \DateTime $date data @param array $type type @param Context $context context @return string serialized date
[ "serialize", "datetime", "to", "json" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/Serializer/Handler/DateHandler.php#L94-L97
26,364
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.loadDoctrineClassMap
private function loadDoctrineClassMap(Finder $finder) { $classMap = []; foreach ($finder as $file) { $classMap = array_merge( $classMap, Yaml::parseFile($file) ); } // filter out superclasses $classMap = array_filter( ...
php
private function loadDoctrineClassMap(Finder $finder) { $classMap = []; foreach ($finder as $file) { $classMap = array_merge( $classMap, Yaml::parseFile($file) ); } // filter out superclasses $classMap = array_filter( ...
[ "private", "function", "loadDoctrineClassMap", "(", "Finder", "$", "finder", ")", "{", "$", "classMap", "=", "[", "]", ";", "foreach", "(", "$", "finder", "as", "$", "file", ")", "{", "$", "classMap", "=", "array_merge", "(", "$", "classMap", ",", "Yam...
Load doctrine class map @param Finder $finder Mapping finder @return array
[ "Load", "doctrine", "class", "map" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L210-L229
26,365
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.loadSerializerClassMap
private function loadSerializerClassMap(Finder $finder) { $classMap = []; foreach ($finder as $file) { $document = new \DOMDocument(); $document->load($file); $xpath = new \DOMXPath($document); $classMap = array_reduce( iterator_to_ar...
php
private function loadSerializerClassMap(Finder $finder) { $classMap = []; foreach ($finder as $file) { $document = new \DOMDocument(); $document->load($file); $xpath = new \DOMXPath($document); $classMap = array_reduce( iterator_to_ar...
[ "private", "function", "loadSerializerClassMap", "(", "Finder", "$", "finder", ")", "{", "$", "classMap", "=", "[", "]", ";", "foreach", "(", "$", "finder", "as", "$", "file", ")", "{", "$", "document", "=", "new", "\\", "DOMDocument", "(", ")", ";", ...
Load serializer class map @param Finder $finder Mapping finder @return array
[ "Load", "serializer", "class", "map" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L237-L257
26,366
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.loadSchemaClassMap
private function loadSchemaClassMap(Finder $finder) { $classMap = []; foreach ($finder as $file) { $schema = json_decode(file_get_contents($file), true); if (!isset($schema['x-documentClass'])) { continue; } foreach ($schema['required...
php
private function loadSchemaClassMap(Finder $finder) { $classMap = []; foreach ($finder as $file) { $schema = json_decode(file_get_contents($file), true); if (!isset($schema['x-documentClass'])) { continue; } foreach ($schema['required...
[ "private", "function", "loadSchemaClassMap", "(", "Finder", "$", "finder", ")", "{", "$", "classMap", "=", "[", "]", ";", "foreach", "(", "$", "finder", "as", "$", "file", ")", "{", "$", "schema", "=", "json_decode", "(", "file_get_contents", "(", "$", ...
Load schema class map @param Finder $finder Mapping finder @return array
[ "Load", "schema", "class", "map" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L265-L307
26,367
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.getSerializerFields
private function getSerializerFields(\DOMElement $mapping) { $xpath = new \DOMXPath($mapping->ownerDocument); return array_map( function (\DOMElement $element) { return [ 'fieldName' => $element->getAttribute('name'), 'fieldType'...
php
private function getSerializerFields(\DOMElement $mapping) { $xpath = new \DOMXPath($mapping->ownerDocument); return array_map( function (\DOMElement $element) { return [ 'fieldName' => $element->getAttribute('name'), 'fieldType'...
[ "private", "function", "getSerializerFields", "(", "\\", "DOMElement", "$", "mapping", ")", "{", "$", "xpath", "=", "new", "\\", "DOMXPath", "(", "$", "mapping", "->", "ownerDocument", ")", ";", "return", "array_map", "(", "function", "(", "\\", "DOMElement"...
Get serializer fields @param \DOMElement $mapping Serializer XML mapping @return array
[ "Get", "serializer", "fields" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L315-L331
26,368
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.getSerializerFieldType
private function getSerializerFieldType(\DOMElement $field) { if ($field->getAttribute('type')) { return $field->getAttribute('type'); } $xpath = new \DOMXPath($field->ownerDocument); $type = $xpath->query('type', $field)->item(0); return $type === null ? null :...
php
private function getSerializerFieldType(\DOMElement $field) { if ($field->getAttribute('type')) { return $field->getAttribute('type'); } $xpath = new \DOMXPath($field->ownerDocument); $type = $xpath->query('type', $field)->item(0); return $type === null ? null :...
[ "private", "function", "getSerializerFieldType", "(", "\\", "DOMElement", "$", "field", ")", "{", "if", "(", "$", "field", "->", "getAttribute", "(", "'type'", ")", ")", "{", "return", "$", "field", "->", "getAttribute", "(", "'type'", ")", ";", "}", "$"...
Get serializer field type @param \DOMElement $field Field node @return string|null
[ "Get", "serializer", "field", "type" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L339-L349
26,369
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.getDoctrineFields
private function getDoctrineFields(array $mapping) { if (!isset($mapping['fields'])) { return []; } return array_map( function ($key, $value) { if (!isset($value['type'])) { $value['type'] = ''; } r...
php
private function getDoctrineFields(array $mapping) { if (!isset($mapping['fields'])) { return []; } return array_map( function ($key, $value) { if (!isset($value['type'])) { $value['type'] = ''; } r...
[ "private", "function", "getDoctrineFields", "(", "array", "$", "mapping", ")", "{", "if", "(", "!", "isset", "(", "$", "mapping", "[", "'fields'", "]", ")", ")", "{", "return", "[", "]", ";", "}", "return", "array_map", "(", "function", "(", "$", "ke...
Get doctrine document fields @param array $mapping Doctrine mapping @return array
[ "Get", "doctrine", "document", "fields" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L357-L377
26,370
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.getRelationList
private function getRelationList($mapping, $suffix) { if (!isset($mapping['embed'.$suffix]) && !isset($mapping['reference'.$suffix])) { return []; } $relations = []; if (isset($mapping['embed'.$suffix])) { $relations = array_merge($relations, $mapping['embed'...
php
private function getRelationList($mapping, $suffix) { if (!isset($mapping['embed'.$suffix]) && !isset($mapping['reference'.$suffix])) { return []; } $relations = []; if (isset($mapping['embed'.$suffix])) { $relations = array_merge($relations, $mapping['embed'...
[ "private", "function", "getRelationList", "(", "$", "mapping", ",", "$", "suffix", ")", "{", "if", "(", "!", "isset", "(", "$", "mapping", "[", "'embed'", ".", "$", "suffix", "]", ")", "&&", "!", "isset", "(", "$", "mapping", "[", "'reference'", ".",...
gets list of relations @param array $mapping mapping @param string $suffix suffix @return array relations
[ "gets", "list", "of", "relations" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L409-L433
26,371
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.getFieldNamesFlat
public function getFieldNamesFlat( Document $document, $documentPrefix = '', $exposedPrefix = '', callable $callback = null, $returnFullField = false ) { $result = []; foreach ($document->getFields() as $field) { if ($this->getFlatFieldCheckCallbac...
php
public function getFieldNamesFlat( Document $document, $documentPrefix = '', $exposedPrefix = '', callable $callback = null, $returnFullField = false ) { $result = []; foreach ($document->getFields() as $field) { if ($this->getFlatFieldCheckCallbac...
[ "public", "function", "getFieldNamesFlat", "(", "Document", "$", "document", ",", "$", "documentPrefix", "=", "''", ",", "$", "exposedPrefix", "=", "''", ",", "callable", "$", "callback", "=", "null", ",", "$", "returnFullField", "=", "false", ")", "{", "$...
Gets an array of all fields, flat with full internal name in dot notation as key and the exposed field name as value. You can pass a callable to limit the fields return a subset of fields. If the callback returns true, the field will be included in the output. You will get the field definition passed to your callback. ...
[ "Gets", "an", "array", "of", "all", "fields", "flat", "with", "full", "internal", "name", "in", "dot", "notation", "as", "key", "and", "the", "exposed", "field", "name", "as", "value", ".", "You", "can", "pass", "a", "callable", "to", "limit", "the", "...
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L449-L510
26,372
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php
DocumentMap.getFlatFieldCheckCallback
private function getFlatFieldCheckCallback($field, callable $callback = null) { if (!is_callable($callback)) { return true; } return call_user_func($callback, $field); }
php
private function getFlatFieldCheckCallback($field, callable $callback = null) { if (!is_callable($callback)) { return true; } return call_user_func($callback, $field); }
[ "private", "function", "getFlatFieldCheckCallback", "(", "$", "field", ",", "callable", "$", "callback", "=", "null", ")", "{", "if", "(", "!", "is_callable", "(", "$", "callback", ")", ")", "{", "return", "true", ";", "}", "return", "call_user_func", "(",...
Simple function to check whether a given shall be returned in the output of getFieldNamesFlat and the optional given callback there. @param AbstractField $field field @param callable|null $callback optional callback @return bool|mixed true if field should be returned, false otherwise
[ "Simple", "function", "to", "check", "whether", "a", "given", "shall", "be", "returned", "in", "the", "output", "of", "getFieldNamesFlat", "and", "the", "optional", "given", "callback", "there", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/DocumentMap.php#L521-L528
26,373
libgraviton/graviton
src/Graviton/ProxyBundle/DependencyInjection/Compiler/TransformerPass.php
TransformerPass.registerTaggedTransformation
private function registerTaggedTransformation(ContainerBuilder $container, Definition $definition, $tag, $callable) { $taggedServices = $container->findTaggedServiceIds($tag); foreach ($taggedServices as $id => $tags) { foreach ($tags as $attributes) { $definition->addMe...
php
private function registerTaggedTransformation(ContainerBuilder $container, Definition $definition, $tag, $callable) { $taggedServices = $container->findTaggedServiceIds($tag); foreach ($taggedServices as $id => $tags) { foreach ($tags as $attributes) { $definition->addMe...
[ "private", "function", "registerTaggedTransformation", "(", "ContainerBuilder", "$", "container", ",", "Definition", "$", "definition", ",", "$", "tag", ",", "$", "callable", ")", "{", "$", "taggedServices", "=", "$", "container", "->", "findTaggedServiceIds", "("...
Adds the found services to the TransformationHandler @param ContainerBuilder $container Symfony Service Container @param Definition $definition Service the services shall be add to. @param string $tag Tag identifying the service to be added @param string $callable Name of the method...
[ "Adds", "the", "found", "services", "to", "the", "TransformationHandler" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/DependencyInjection/Compiler/TransformerPass.php#L71-L87
26,374
libgraviton/graviton
app/AppKernel.php
AppKernel.initializeContainer
protected function initializeContainer() { static $first = true; if ('test' !== $this->getEnvironment()) { parent::initializeContainer(); return; } $debug = $this->debug; if (!$first) { // disable debug mode on all but the first initiali...
php
protected function initializeContainer() { static $first = true; if ('test' !== $this->getEnvironment()) { parent::initializeContainer(); return; } $debug = $this->debug; if (!$first) { // disable debug mode on all but the first initiali...
[ "protected", "function", "initializeContainer", "(", ")", "{", "static", "$", "first", "=", "true", ";", "if", "(", "'test'", "!==", "$", "this", "->", "getEnvironment", "(", ")", ")", "{", "parent", "::", "initializeContainer", "(", ")", ";", "return", ...
dont rebuild container with debug over and over again during tests This is very much what is described in http://kriswallsmith.net/post/27979797907 @return void
[ "dont", "rebuild", "container", "with", "debug", "over", "and", "over", "again", "during", "tests" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/app/AppKernel.php#L119-L146
26,375
libgraviton/graviton
src/Graviton/SecurityBundle/User/Model/ModelFactory.php
ModelFactory.create
public function create() { $serviceId = $this->container->getParameter('graviton.security.authentication.provider.model'); $service = $this->container->get('graviton.security.authentication.provider.model.noop'); if (!empty($serviceId) && $this->container->has($serviceId)) { $se...
php
public function create() { $serviceId = $this->container->getParameter('graviton.security.authentication.provider.model'); $service = $this->container->get('graviton.security.authentication.provider.model.noop'); if (!empty($serviceId) && $this->container->has($serviceId)) { $se...
[ "public", "function", "create", "(", ")", "{", "$", "serviceId", "=", "$", "this", "->", "container", "->", "getParameter", "(", "'graviton.security.authentication.provider.model'", ")", ";", "$", "service", "=", "$", "this", "->", "container", "->", "get", "(...
Determines what service to be used. @return \Graviton\RestBundle\Model\ModelInterface
[ "Determines", "what", "service", "to", "be", "used", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/User/Model/ModelFactory.php#L39-L49
26,376
libgraviton/graviton
src/Graviton/SchemaBundle/Constraint/ReadOnlyFieldConstraint.php
ReadOnlyFieldConstraint.propertyExists
private function propertyExists($object, $fieldName) { if (property_exists($object, $fieldName)) { return true; } foreach (explode('.', $fieldName) as $field) { if (property_exists($object, $field)) { $object = $object->{$field}; if (!...
php
private function propertyExists($object, $fieldName) { if (property_exists($object, $fieldName)) { return true; } foreach (explode('.', $fieldName) as $field) { if (property_exists($object, $field)) { $object = $object->{$field}; if (!...
[ "private", "function", "propertyExists", "(", "$", "object", ",", "$", "fieldName", ")", "{", "if", "(", "property_exists", "(", "$", "object", ",", "$", "fieldName", ")", ")", "{", "return", "true", ";", "}", "foreach", "(", "explode", "(", "'.'", ","...
To validate before accessor brakes with not found field @param object $object To be parsed @param string $fieldName Field name, dot chained. @return bool
[ "To", "validate", "before", "accessor", "brakes", "with", "not", "found", "field" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Constraint/ReadOnlyFieldConstraint.php#L103-L121
26,377
libgraviton/graviton
src/Graviton/ProxyBundle/Service/MappingTransformer.php
MappingTransformer.transform
public function transform($raw, array $mapping, $transformed = []) { foreach ($mapping as $destination => $source) { $value = $this->propertyAccessor->isReadable($raw, $source) ? $this->propertyAccessor->getValue($raw, $source) : null; $this->propertyAccessor->setValu...
php
public function transform($raw, array $mapping, $transformed = []) { foreach ($mapping as $destination => $source) { $value = $this->propertyAccessor->isReadable($raw, $source) ? $this->propertyAccessor->getValue($raw, $source) : null; $this->propertyAccessor->setValu...
[ "public", "function", "transform", "(", "$", "raw", ",", "array", "$", "mapping", ",", "$", "transformed", "=", "[", "]", ")", "{", "foreach", "(", "$", "mapping", "as", "$", "destination", "=>", "$", "source", ")", "{", "$", "value", "=", "$", "th...
Applies the given mapping on a given object or array. @param object|array $raw The input object or array @param array $mapping The mapping @param object|array $transformed The output object or array. @return array
[ "Applies", "the", "given", "mapping", "on", "a", "given", "object", "or", "array", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Service/MappingTransformer.php#L43-L51
26,378
libgraviton/graviton
src/Graviton/CoreBundle/GravitonCoreBundle.php
GravitonCoreBundle.build
public function build(ContainerBuilder $container) { parent::build($container); $container->addCompilerPass(new VersionCompilerPass(new PrettyVersions())); $container->addCompilerPass(new EnvParametersCompilerPass()); $container->addCompilerPass(new RouteLoaderCompilerPass()); ...
php
public function build(ContainerBuilder $container) { parent::build($container); $container->addCompilerPass(new VersionCompilerPass(new PrettyVersions())); $container->addCompilerPass(new EnvParametersCompilerPass()); $container->addCompilerPass(new RouteLoaderCompilerPass()); ...
[ "public", "function", "build", "(", "ContainerBuilder", "$", "container", ")", "{", "parent", "::", "build", "(", "$", "container", ")", ";", "$", "container", "->", "addCompilerPass", "(", "new", "VersionCompilerPass", "(", "new", "PrettyVersions", "(", ")", ...
load version compiler pass @param ContainerBuilder $container container builder @return void
[ "load", "version", "compiler", "pass" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/CoreBundle/GravitonCoreBundle.php#L74-L82
26,379
libgraviton/graviton
src/Graviton/GeneratorBundle/Generator/ResourceGenerator/FieldMapper.php
FieldMapper.buildFields
public function buildFields(JsonDefinition $jsonDefinition) { $fields = []; foreach ($jsonDefinition->getFields() as $field) { if ($field->getName() != 'id') { $fields[] = [ 'fieldName' => $field->getName(), 'type' => $field->getTyp...
php
public function buildFields(JsonDefinition $jsonDefinition) { $fields = []; foreach ($jsonDefinition->getFields() as $field) { if ($field->getName() != 'id') { $fields[] = [ 'fieldName' => $field->getName(), 'type' => $field->getTyp...
[ "public", "function", "buildFields", "(", "JsonDefinition", "$", "jsonDefinition", ")", "{", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "jsonDefinition", "->", "getFields", "(", ")", "as", "$", "field", ")", "{", "if", "(", "$", "field", "...
builds the initial fields array with a json definition @param JsonDefinition $jsonDefinition definition @return array fields
[ "builds", "the", "initial", "fields", "array", "with", "a", "json", "definition" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Generator/ResourceGenerator/FieldMapper.php#L39-L52
26,380
libgraviton/graviton
src/Graviton/CoreBundle/Event/HomepageRenderEvent.php
HomepageRenderEvent.addRoute
public function addRoute($url, $schemaUrl) { $this->addedRoutes[] = [ '$ref' => $this->normalizeRelativeUrl($url), 'profile' => $this->normalizeRelativeUrl($schemaUrl) ]; }
php
public function addRoute($url, $schemaUrl) { $this->addedRoutes[] = [ '$ref' => $this->normalizeRelativeUrl($url), 'profile' => $this->normalizeRelativeUrl($schemaUrl) ]; }
[ "public", "function", "addRoute", "(", "$", "url", ",", "$", "schemaUrl", ")", "{", "$", "this", "->", "addedRoutes", "[", "]", "=", "[", "'$ref'", "=>", "$", "this", "->", "normalizeRelativeUrl", "(", "$", "url", ")", ",", "'profile'", "=>", "$", "t...
add a route to the homepage @param string $url relative (to root) url to the service @param string $schemaUrl relative (to root) url to the schema @return void
[ "add", "a", "route", "to", "the", "homepage" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/CoreBundle/Event/HomepageRenderEvent.php#L39-L45
26,381
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/TranslatableFieldsCompilerPass.php
TranslatableFieldsCompilerPass.process
public function process(ContainerBuilder $container) { $this->documentMap = $container->get('graviton.document.map'); $map = []; foreach ($this->documentMap->getDocuments() as $document) { $map[$document->getClass()] = $this->getTranslatableFields($document); } $c...
php
public function process(ContainerBuilder $container) { $this->documentMap = $container->get('graviton.document.map'); $map = []; foreach ($this->documentMap->getDocuments() as $document) { $map[$document->getClass()] = $this->getTranslatableFields($document); } $c...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "this", "->", "documentMap", "=", "$", "container", "->", "get", "(", "'graviton.document.map'", ")", ";", "$", "map", "=", "[", "]", ";", "foreach", "(", "$", "th...
Make translatable fields map and set it to parameter @param ContainerBuilder $container container builder @return void
[ "Make", "translatable", "fields", "map", "and", "set", "it", "to", "parameter" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/TranslatableFieldsCompilerPass.php#L36-L50
26,382
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/TranslatableFieldsCompilerPass.php
TranslatableFieldsCompilerPass.getTranslatableFields
private function getTranslatableFields(Document $document, $prefix = '') { $result = []; foreach ($document->getFields() as $field) { if ($field instanceof Field) { if ($field->getType() == 'translatable') { $result[] = $prefix.$field->getExposedName()...
php
private function getTranslatableFields(Document $document, $prefix = '') { $result = []; foreach ($document->getFields() as $field) { if ($field instanceof Field) { if ($field->getType() == 'translatable') { $result[] = $prefix.$field->getExposedName()...
[ "private", "function", "getTranslatableFields", "(", "Document", "$", "document", ",", "$", "prefix", "=", "''", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "document", "->", "getFields", "(", ")", "as", "$", "field", ")", "{", ...
Get document fields @param Document $document Document @param string $prefix Field prefix @return array
[ "Get", "document", "fields" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/TranslatableFieldsCompilerPass.php#L59-L87
26,383
libgraviton/graviton
src/Graviton/SchemaBundle/Constraint/Builder/RangeConstraintBuilder.php
RangeConstraintBuilder.supportsConstraint
public function supportsConstraint($type, array $options = []) { if (in_array($type, $this->types)) { $this->type = $type; return true; } return false; }
php
public function supportsConstraint($type, array $options = []) { if (in_array($type, $this->types)) { $this->type = $type; return true; } return false; }
[ "public", "function", "supportsConstraint", "(", "$", "type", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "in_array", "(", "$", "type", ",", "$", "this", "->", "types", ")", ")", "{", "$", "this", "->", "type", "=", "$", "ty...
if this builder supports a given constraint @param string $type Field type @param array $options Options @return bool
[ "if", "this", "builder", "supports", "a", "given", "constraint" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Constraint/Builder/RangeConstraintBuilder.php#L41-L49
26,384
libgraviton/graviton
src/Graviton/SchemaBundle/SchemaUtils.php
SchemaUtils.getCollectionSchema
public function getCollectionSchema($modelName, DocumentModel $model) { $collectionSchema = new Schema; $collectionSchema->setTitle(sprintf('Array of %s objects', $modelName)); $collectionSchema->setType('array'); $collectionSchema->setItems($this->getModelSchema($modelName, $model))...
php
public function getCollectionSchema($modelName, DocumentModel $model) { $collectionSchema = new Schema; $collectionSchema->setTitle(sprintf('Array of %s objects', $modelName)); $collectionSchema->setType('array'); $collectionSchema->setItems($this->getModelSchema($modelName, $model))...
[ "public", "function", "getCollectionSchema", "(", "$", "modelName", ",", "DocumentModel", "$", "model", ")", "{", "$", "collectionSchema", "=", "new", "Schema", ";", "$", "collectionSchema", "->", "setTitle", "(", "sprintf", "(", "'Array of %s objects'", ",", "$...
get schema for an array of models @param string $modelName name of model @param DocumentModel $model model @return Schema
[ "get", "schema", "for", "an", "array", "of", "models" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/SchemaUtils.php#L163-L170
26,385
libgraviton/graviton
src/Graviton/SchemaBundle/SchemaUtils.php
SchemaUtils.getSchemaVariationName
private function getSchemaVariationName($userData, $variations) { foreach ($variations as $variationName => $expressions) { $results = array_map( function ($expression) use ($userData) { return $this->jmesRuntime->__invoke($expression, $userData); ...
php
private function getSchemaVariationName($userData, $variations) { foreach ($variations as $variationName => $expressions) { $results = array_map( function ($expression) use ($userData) { return $this->jmesRuntime->__invoke($expression, $userData); ...
[ "private", "function", "getSchemaVariationName", "(", "$", "userData", ",", "$", "variations", ")", "{", "foreach", "(", "$", "variations", "as", "$", "variationName", "=>", "$", "expressions", ")", "{", "$", "results", "=", "array_map", "(", "function", "("...
gets the name of the variation to apply based on userdata and the service definition @param \stdClass $userData user data @param \stdClass $variations variations as defined in schema @return string|null the variation name or null if none
[ "gets", "the", "name", "of", "the", "variation", "to", "apply", "based", "on", "userdata", "and", "the", "service", "definition" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/SchemaUtils.php#L482-L500
26,386
libgraviton/graviton
src/Graviton/SchemaBundle/SchemaUtils.php
SchemaUtils.makeTranslatable
public function makeTranslatable(Schema $property, $languages) { $property->setType('object'); $property->setTranslatable(true); array_walk( $languages, function ($language) use ($property) { $schema = new Schema; $schema->setType('str...
php
public function makeTranslatable(Schema $property, $languages) { $property->setType('object'); $property->setTranslatable(true); array_walk( $languages, function ($language) use ($property) { $schema = new Schema; $schema->setType('str...
[ "public", "function", "makeTranslatable", "(", "Schema", "$", "property", ",", "$", "languages", ")", "{", "$", "property", "->", "setType", "(", "'object'", ")", ";", "$", "property", "->", "setTranslatable", "(", "true", ")", ";", "array_walk", "(", "$",...
turn a property into a translatable property @param Schema $property simple string property @param string[] $languages available languages @return Schema
[ "turn", "a", "property", "into", "a", "translatable", "property" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/SchemaUtils.php#L510-L527
26,387
libgraviton/graviton
src/Graviton/SchemaBundle/SchemaUtils.php
SchemaUtils.makeArrayTranslatable
public function makeArrayTranslatable(Schema $property, $languages) { $property->setType('array'); $property->setItems($this->makeTranslatable(new Schema(), $languages)); return $property; }
php
public function makeArrayTranslatable(Schema $property, $languages) { $property->setType('array'); $property->setItems($this->makeTranslatable(new Schema(), $languages)); return $property; }
[ "public", "function", "makeArrayTranslatable", "(", "Schema", "$", "property", ",", "$", "languages", ")", "{", "$", "property", "->", "setType", "(", "'array'", ")", ";", "$", "property", "->", "setItems", "(", "$", "this", "->", "makeTranslatable", "(", ...
turn a array property into a translatable property @param Schema $property simple string property @param string[] $languages available languages @return Schema
[ "turn", "a", "array", "property", "into", "a", "translatable", "property" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/SchemaUtils.php#L537-L542
26,388
libgraviton/graviton
src/Graviton/SchemaBundle/SchemaUtils.php
SchemaUtils.getSchemaRouteName
public static function getSchemaRouteName($routeName) { $routeParts = explode('.', $routeName); $routeType = array_pop($routeParts); // check if we need to create an item or collection schema $realRouteType = 'canonicalSchema'; if ($routeType != 'options' && $routeType != 'a...
php
public static function getSchemaRouteName($routeName) { $routeParts = explode('.', $routeName); $routeType = array_pop($routeParts); // check if we need to create an item or collection schema $realRouteType = 'canonicalSchema'; if ($routeType != 'options' && $routeType != 'a...
[ "public", "static", "function", "getSchemaRouteName", "(", "$", "routeName", ")", "{", "$", "routeParts", "=", "explode", "(", "'.'", ",", "$", "routeName", ")", ";", "$", "routeType", "=", "array_pop", "(", "$", "routeParts", ")", ";", "// check if we need ...
get canonical route to a schema based on a route @param string $routeName route name @return string schema route name
[ "get", "canonical", "route", "to", "a", "schema", "based", "on", "a", "route" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/SchemaUtils.php#L551-L563
26,389
libgraviton/graviton
src/Graviton/SchemaBundle/SchemaUtils.php
SchemaUtils.getCollectionItemType
private function getCollectionItemType($className, $fieldName) { $serializerMetadata = $this->serializerMetadataFactory->getMetadataForClass($className); if ($serializerMetadata === null) { return null; } if (!isset($serializerMetadata->propertyMetadata[$fieldName])) { ...
php
private function getCollectionItemType($className, $fieldName) { $serializerMetadata = $this->serializerMetadataFactory->getMetadataForClass($className); if ($serializerMetadata === null) { return null; } if (!isset($serializerMetadata->propertyMetadata[$fieldName])) { ...
[ "private", "function", "getCollectionItemType", "(", "$", "className", ",", "$", "fieldName", ")", "{", "$", "serializerMetadata", "=", "$", "this", "->", "serializerMetadataFactory", "->", "getMetadataForClass", "(", "$", "className", ")", ";", "if", "(", "$", ...
Get item type of collection field @param string $className Class name @param string $fieldName Field name @return string|null
[ "Get", "item", "type", "of", "collection", "field" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/SchemaUtils.php#L572-L586
26,390
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.serializeContent
public function serializeContent($content, $format = 'json') { try { return $this->getSerializer()->serialize( $content, $format ); } catch (\Exception $e) { $msg = sprintf( 'Cannot serialize content class: %s; with ...
php
public function serializeContent($content, $format = 'json') { try { return $this->getSerializer()->serialize( $content, $format ); } catch (\Exception $e) { $msg = sprintf( 'Cannot serialize content class: %s; with ...
[ "public", "function", "serializeContent", "(", "$", "content", ",", "$", "format", "=", "'json'", ")", "{", "try", "{", "return", "$", "this", "->", "getSerializer", "(", ")", "->", "serialize", "(", "$", "content", ",", "$", "format", ")", ";", "}", ...
Public function to serialize stuff according to the serializer rules. @param object $content Any content to serialize @param string $format Which format to serialize into @throws \Exception @return string $content Json content
[ "Public", "function", "to", "serialize", "stuff", "according", "to", "the", "serializer", "rules", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L143-L160
26,391
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.validateContent
public function validateContent($content, DocumentModel $model) { if (is_string($content)) { $content = json_decode($content); } return $this->schemaValidator->validate( $content, $this->schemaUtils->getModelSchema(null, $model, true, true, true, $content...
php
public function validateContent($content, DocumentModel $model) { if (is_string($content)) { $content = json_decode($content); } return $this->schemaValidator->validate( $content, $this->schemaUtils->getModelSchema(null, $model, true, true, true, $content...
[ "public", "function", "validateContent", "(", "$", "content", ",", "DocumentModel", "$", "model", ")", "{", "if", "(", "is_string", "(", "$", "content", ")", ")", "{", "$", "content", "=", "json_decode", "(", "$", "content", ")", ";", "}", "return", "$...
Validates content with the given schema, returning an array of errors. If all is good, you will receive an empty array. @param object $content \stdClass of the request content @param DocumentModel $model the model to check the schema for @return \Graviton\JsonSchemaBundle\Exception\ValidationExceptionError[]...
[ "Validates", "content", "with", "the", "given", "schema", "returning", "an", "array", "of", "errors", ".", "If", "all", "is", "good", "you", "will", "receive", "an", "empty", "array", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L194-L204
26,392
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.checkJsonRequest
public function checkJsonRequest(Request $request, Response $response, DocumentModel $model, $content = '') { if (empty($content)) { $content = $request->getContent(); } if (is_resource($content)) { throw new BadRequestHttpException('unexpected resource in validation...
php
public function checkJsonRequest(Request $request, Response $response, DocumentModel $model, $content = '') { if (empty($content)) { $content = $request->getContent(); } if (is_resource($content)) { throw new BadRequestHttpException('unexpected resource in validation...
[ "public", "function", "checkJsonRequest", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "DocumentModel", "$", "model", ",", "$", "content", "=", "''", ")", "{", "if", "(", "empty", "(", "$", "content", ")", ")", "{", "$", "cont...
validate raw json input @param Request $request request @param Response $response response @param DocumentModel $model model @param string $content Alternative request content. @return void
[ "validate", "raw", "json", "input" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L216-L265
26,393
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.checkJsonPatchRequest
public function checkJsonPatchRequest(array $jsonPatch) { foreach ($jsonPatch as $operation) { if (!is_array($operation)) { throw new InvalidJsonPatchException('Patch request should be an array of operations.'); } if (array_key_exists('path', $operation) &...
php
public function checkJsonPatchRequest(array $jsonPatch) { foreach ($jsonPatch as $operation) { if (!is_array($operation)) { throw new InvalidJsonPatchException('Patch request should be an array of operations.'); } if (array_key_exists('path', $operation) &...
[ "public", "function", "checkJsonPatchRequest", "(", "array", "$", "jsonPatch", ")", "{", "foreach", "(", "$", "jsonPatch", "as", "$", "operation", ")", "{", "if", "(", "!", "is_array", "(", "$", "operation", ")", ")", "{", "throw", "new", "InvalidJsonPatch...
Validate JSON patch for any object @param array $jsonPatch json patch as array @throws InvalidJsonPatchException @return void
[ "Validate", "JSON", "patch", "for", "any", "object" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L275-L285
26,394
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.getOptionRoutes
public function getOptionRoutes() { $cached = $this->cacheProvider->fetch('cached_restutils_route_options'); if ($cached) { return $cached; } $ret = array_filter( $this->router->getRouteCollection()->all(), function ($route) { if (!...
php
public function getOptionRoutes() { $cached = $this->cacheProvider->fetch('cached_restutils_route_options'); if ($cached) { return $cached; } $ret = array_filter( $this->router->getRouteCollection()->all(), function ($route) { if (!...
[ "public", "function", "getOptionRoutes", "(", ")", "{", "$", "cached", "=", "$", "this", "->", "cacheProvider", "->", "fetch", "(", "'cached_restutils_route_options'", ")", ";", "if", "(", "$", "cached", ")", "{", "return", "$", "cached", ";", "}", "$", ...
It has been deemed that we search for OPTION routes in order to detect our service routes and then derive the rest from them. @return array An array with option routes
[ "It", "has", "been", "deemed", "that", "we", "search", "for", "OPTION", "routes", "in", "order", "to", "detect", "our", "service", "routes", "and", "then", "derive", "the", "rest", "from", "them", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L319-L344
26,395
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.getModelFromRoute
public function getModelFromRoute(Route $route) { $ret = false; $controller = $this->getControllerFromRoute($route); if ($controller instanceof RestController) { $ret = $controller->getModel(); } return $ret; }
php
public function getModelFromRoute(Route $route) { $ret = false; $controller = $this->getControllerFromRoute($route); if ($controller instanceof RestController) { $ret = $controller->getModel(); } return $ret; }
[ "public", "function", "getModelFromRoute", "(", "Route", "$", "route", ")", "{", "$", "ret", "=", "false", ";", "$", "controller", "=", "$", "this", "->", "getControllerFromRoute", "(", "$", "route", ")", ";", "if", "(", "$", "controller", "instanceof", ...
Gets the Model assigned to the RestController @param Route $route Route @return bool|object The model or false @throws \Exception
[ "Gets", "the", "Model", "assigned", "to", "the", "RestController" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L381-L391
26,396
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.getControllerFromRoute
public function getControllerFromRoute(Route $route) { $ret = false; $actionParts = explode(':', $route->getDefault('_controller')); if (count($actionParts) == 2) { $ret = $this->container->get($actionParts[0]); } return $ret; }
php
public function getControllerFromRoute(Route $route) { $ret = false; $actionParts = explode(':', $route->getDefault('_controller')); if (count($actionParts) == 2) { $ret = $this->container->get($actionParts[0]); } return $ret; }
[ "public", "function", "getControllerFromRoute", "(", "Route", "$", "route", ")", "{", "$", "ret", "=", "false", ";", "$", "actionParts", "=", "explode", "(", "':'", ",", "$", "route", "->", "getDefault", "(", "'_controller'", ")", ")", ";", "if", "(", ...
Gets the controller from a Route @param Route $route Route @return bool|object The controller or false
[ "Gets", "the", "controller", "from", "a", "Route" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L400-L410
26,397
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.serialize
public function serialize($result) { try { // array is serialized as an object {"0":{...},"1":{...},...} when data contains an empty objects // we serialize each item because we can assume this bug affects only root array element if (is_array($result) && array_keys($resul...
php
public function serialize($result) { try { // array is serialized as an object {"0":{...},"1":{...},...} when data contains an empty objects // we serialize each item because we can assume this bug affects only root array element if (is_array($result) && array_keys($resul...
[ "public", "function", "serialize", "(", "$", "result", ")", "{", "try", "{", "// array is serialized as an object {\"0\":{...},\"1\":{...},...} when data contains an empty objects", "// we serialize each item because we can assume this bug affects only root array element", "if", "(", "is...
Serialize the given record and throw an exception if something went wrong @param object|object[] $result Record(s) @throws \Graviton\ExceptionBundle\Exception\SerializationException @return string $content Json content
[ "Serialize", "the", "given", "record", "and", "throw", "an", "exception", "if", "something", "went", "wrong" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L438-L458
26,398
libgraviton/graviton
src/Graviton/RestBundle/Service/RestUtils.php
RestUtils.validateRequest
public function validateRequest($content, DocumentModel $model) { $errors = $this->validateContent($content, $model); if (!empty($errors)) { throw new ValidationException($errors); } return $this->deserialize($content, $model->getEntityClass()); }
php
public function validateRequest($content, DocumentModel $model) { $errors = $this->validateContent($content, $model); if (!empty($errors)) { throw new ValidationException($errors); } return $this->deserialize($content, $model->getEntityClass()); }
[ "public", "function", "validateRequest", "(", "$", "content", ",", "DocumentModel", "$", "model", ")", "{", "$", "errors", "=", "$", "this", "->", "validateContent", "(", "$", "content", ",", "$", "model", ")", ";", "if", "(", "!", "empty", "(", "$", ...
Validates the current request on schema violations. If there are errors, the exception is thrown. If not, the deserialized record is returned. @param object|string $content \stdClass of the request content @param DocumentModel $model the model to check the schema for @return ValidationExceptionError|Object @throws ...
[ "Validates", "the", "current", "request", "on", "schema", "violations", ".", "If", "there", "are", "errors", "the", "exception", "is", "thrown", ".", "If", "not", "the", "deserialized", "record", "is", "returned", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/RestUtils.php#L494-L501
26,399
libgraviton/graviton
src/Graviton/RestBundle/ExclusionStrategy/SelectExclusionStrategy.php
SelectExclusionStrategy.createArrayByPath
private function createArrayByPath($path) { $keys = explode('.', $path); $val = true; $localArray = []; for ($i=count($keys)-1; $i>=0; $i--) { $localArray = [$keys[$i]=>$val]; $val = $localArray; } return $localArray; }
php
private function createArrayByPath($path) { $keys = explode('.', $path); $val = true; $localArray = []; for ($i=count($keys)-1; $i>=0; $i--) { $localArray = [$keys[$i]=>$val]; $val = $localArray; } return $localArray; }
[ "private", "function", "createArrayByPath", "(", "$", "path", ")", "{", "$", "keys", "=", "explode", "(", "'.'", ",", "$", "path", ")", ";", "$", "val", "=", "true", ";", "$", "localArray", "=", "[", "]", ";", "for", "(", "$", "i", "=", "count", ...
Convert dot string to array. @param string $path string dotted array @return array
[ "Convert", "dot", "string", "to", "array", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/ExclusionStrategy/SelectExclusionStrategy.php#L62-L72