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,400
libgraviton/graviton
src/Graviton/RestBundle/Model/DocumentModel.php
DocumentModel.setRepository
public function setRepository(DocumentRepository $repository) { $this->repository = $repository; $this->manager = $repository->getDocumentManager(); return $this; }
php
public function setRepository(DocumentRepository $repository) { $this->repository = $repository; $this->manager = $repository->getDocumentManager(); return $this; }
[ "public", "function", "setRepository", "(", "DocumentRepository", "$", "repository", ")", "{", "$", "this", "->", "repository", "=", "$", "repository", ";", "$", "this", "->", "manager", "=", "$", "repository", "->", "getDocumentManager", "(", ")", ";", "ret...
create new app model @param DocumentRepository $repository Repository of countries @return \Graviton\RestBundle\Model\DocumentModel
[ "create", "new", "app", "model" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Model/DocumentModel.php#L113-L118
26,401
libgraviton/graviton
src/Graviton/RestBundle/Model/DocumentModel.php
DocumentModel.find
public function find($documentId, $forceClear = false) { if ($forceClear) { $this->repository->clear(); } $result = $this->repository->find($documentId); if (empty($result)) { throw new NotFoundException("Entry with id " . $documentId . " not found!"); ...
php
public function find($documentId, $forceClear = false) { if ($forceClear) { $this->repository->clear(); } $result = $this->repository->find($documentId); if (empty($result)) { throw new NotFoundException("Entry with id " . $documentId . " not found!"); ...
[ "public", "function", "find", "(", "$", "documentId", ",", "$", "forceClear", "=", "false", ")", "{", "if", "(", "$", "forceClear", ")", "{", "$", "this", "->", "repository", "->", "clear", "(", ")", ";", "}", "$", "result", "=", "$", "this", "->",...
finds a single entity @param string $documentId id of entity to find @param boolean $forceClear if we should clear the repository prior to fetching @throws NotFoundException @return Object
[ "finds", "a", "single", "entity" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Model/DocumentModel.php#L165-L177
26,402
libgraviton/graviton
src/Graviton/RestBundle/Model/DocumentModel.php
DocumentModel.getSerialised
public function getSerialised($documentId, Request $request = null) { if (is_null($request)) { $request = Request::create(''); } $request->attributes->set('singleDocument', $documentId); $document = $this->queryService->getWithRequest($request, $this->repository); ...
php
public function getSerialised($documentId, Request $request = null) { if (is_null($request)) { $request = Request::create(''); } $request->attributes->set('singleDocument', $documentId); $document = $this->queryService->getWithRequest($request, $this->repository); ...
[ "public", "function", "getSerialised", "(", "$", "documentId", ",", "Request", "$", "request", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "request", ")", ")", "{", "$", "request", "=", "Request", "::", "create", "(", "''", ")", ";", "}", ...
Will attempt to find Document by ID. If config cache is enabled for document it will save it. @param string $documentId id of entity to find @param Request $request request @throws NotFoundException @return string Serialised object
[ "Will", "attempt", "to", "find", "Document", "by", "ID", ".", "If", "config", "cache", "is", "enabled", "for", "document", "it", "will", "save", "it", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Model/DocumentModel.php#L189-L208
26,403
libgraviton/graviton
src/Graviton/RestBundle/Model/DocumentModel.php
DocumentModel.deleteById
private function deleteById($id) { $builder = $this->repository->createQueryBuilder(); $builder ->remove() ->field('id')->equals($id) ->getQuery() ->execute(); }
php
private function deleteById($id) { $builder = $this->repository->createQueryBuilder(); $builder ->remove() ->field('id')->equals($id) ->getQuery() ->execute(); }
[ "private", "function", "deleteById", "(", "$", "id", ")", "{", "$", "builder", "=", "$", "this", "->", "repository", "->", "createQueryBuilder", "(", ")", ";", "$", "builder", "->", "remove", "(", ")", "->", "field", "(", "'id'", ")", "->", "equals", ...
A low level delete without any checks @param mixed $id record id @return void
[ "A", "low", "level", "delete", "without", "any", "checks" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Model/DocumentModel.php#L293-L301
26,404
libgraviton/graviton
src/Graviton/RestBundle/Model/DocumentModel.php
DocumentModel.checkIfOriginRecord
protected function checkIfOriginRecord($record) { if ($record instanceof RecordOriginInterface && !$record->isRecordOriginModifiable() ) { $values = $this->notModifiableOriginRecords; $originValue = strtolower(trim($record->getRecordOrigin())); if (in...
php
protected function checkIfOriginRecord($record) { if ($record instanceof RecordOriginInterface && !$record->isRecordOriginModifiable() ) { $values = $this->notModifiableOriginRecords; $originValue = strtolower(trim($record->getRecordOrigin())); if (in...
[ "protected", "function", "checkIfOriginRecord", "(", "$", "record", ")", "{", "if", "(", "$", "record", "instanceof", "RecordOriginInterface", "&&", "!", "$", "record", "->", "isRecordOriginModifiable", "(", ")", ")", "{", "$", "values", "=", "$", "this", "-...
Checks the recordOrigin attribute of a record and will throw an exception if value is not allowed @param Object $record record @return void
[ "Checks", "the", "recordOrigin", "attribute", "of", "a", "record", "and", "will", "throw", "an", "exception", "if", "value", "is", "not", "allowed" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Model/DocumentModel.php#L364-L378
26,405
libgraviton/graviton
src/Graviton/RestBundle/Model/DocumentModel.php
DocumentModel.dispatchModelEvent
private function dispatchModelEvent($action, $collection) { if (!($this->repository instanceof DocumentRepository)) { return; } if (!method_exists($collection, 'getId')) { return; } $event = new ModelEvent(); $event->setCollectionId($collectio...
php
private function dispatchModelEvent($action, $collection) { if (!($this->repository instanceof DocumentRepository)) { return; } if (!method_exists($collection, 'getId')) { return; } $event = new ModelEvent(); $event->setCollectionId($collectio...
[ "private", "function", "dispatchModelEvent", "(", "$", "action", ",", "$", "collection", ")", "{", "if", "(", "!", "(", "$", "this", "->", "repository", "instanceof", "DocumentRepository", ")", ")", "{", "return", ";", "}", "if", "(", "!", "method_exists",...
Will fire a ModelEvent @param string $action insert or update @param Object $collection the changed Document @return void
[ "Will", "fire", "a", "ModelEvent" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Model/DocumentModel.php#L390-L407
26,406
libgraviton/graviton
src/Graviton/SecurityBundle/Service/SecurityUtils.php
SecurityUtils.isSecurityUser
public function isSecurityUser() { if ($this->securityUser) { return true; } /** @var PreAuthenticatedToken $token */ if (($token = $this->tokenStorage->getToken()) && ($user = $token->getUser()) instanceof UserInterface ) { $this->securit...
php
public function isSecurityUser() { if ($this->securityUser) { return true; } /** @var PreAuthenticatedToken $token */ if (($token = $this->tokenStorage->getToken()) && ($user = $token->getUser()) instanceof UserInterface ) { $this->securit...
[ "public", "function", "isSecurityUser", "(", ")", "{", "if", "(", "$", "this", "->", "securityUser", ")", "{", "return", "true", ";", "}", "/** @var PreAuthenticatedToken $token */", "if", "(", "(", "$", "token", "=", "$", "this", "->", "tokenStorage", "->",...
Check if there is a security user @return bool
[ "Check", "if", "there", "is", "a", "security", "user" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Service/SecurityUtils.php#L43-L56
26,407
libgraviton/graviton
src/Graviton/SecurityBundle/Service/SecurityUtils.php
SecurityUtils.hasRole
public function hasRole($role) { if ($this->isSecurityUser()) { return (bool) $this->securityUser->hasRole($role); } throw new UsernameNotFoundException('No security user'); }
php
public function hasRole($role) { if ($this->isSecurityUser()) { return (bool) $this->securityUser->hasRole($role); } throw new UsernameNotFoundException('No security user'); }
[ "public", "function", "hasRole", "(", "$", "role", ")", "{", "if", "(", "$", "this", "->", "isSecurityUser", "(", ")", ")", "{", "return", "(", "bool", ")", "$", "this", "->", "securityUser", "->", "hasRole", "(", "$", "role", ")", ";", "}", "throw...
Check if current user is in Role @param string $role User role expected @return bool @throws UsernameNotFoundException
[ "Check", "if", "current", "user", "is", "in", "Role" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Service/SecurityUtils.php#L93-L99
26,408
libgraviton/graviton
src/Graviton/SecurityBundle/Service/SecurityUtils.php
SecurityUtils.generateUuid
private function generateUuid() { if (!function_exists('openssl_random_pseudo_bytes')) { $this->requestId = uniqid('unq', true); } else { $data = openssl_random_pseudo_bytes(16); // set version to 0100 $data[6] = chr(ord($data[6]) & 0x0f | 0x40); ...
php
private function generateUuid() { if (!function_exists('openssl_random_pseudo_bytes')) { $this->requestId = uniqid('unq', true); } else { $data = openssl_random_pseudo_bytes(16); // set version to 0100 $data[6] = chr(ord($data[6]) & 0x0f | 0x40); ...
[ "private", "function", "generateUuid", "(", ")", "{", "if", "(", "!", "function_exists", "(", "'openssl_random_pseudo_bytes'", ")", ")", "{", "$", "this", "->", "requestId", "=", "uniqid", "(", "'unq'", ",", "true", ")", ";", "}", "else", "{", "$", "data...
Generate a unique UUID. @return string
[ "Generate", "a", "unique", "UUID", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Service/SecurityUtils.php#L119-L133
26,409
libgraviton/graviton
src/Graviton/I18nBundle/Serializer/Handler/TranslatableHandler.php
TranslatableHandler.serializeTranslatableToJson
public function serializeTranslatableToJson( JsonSerializationVisitor $visitor, $translatable, array $type, Context $context ) { if (is_array($translatable) && empty($translatable)) { return $translatable; } $translations = $translatable->getTrans...
php
public function serializeTranslatableToJson( JsonSerializationVisitor $visitor, $translatable, array $type, Context $context ) { if (is_array($translatable) && empty($translatable)) { return $translatable; } $translations = $translatable->getTrans...
[ "public", "function", "serializeTranslatableToJson", "(", "JsonSerializationVisitor", "$", "visitor", ",", "$", "translatable", ",", "array", "$", "type", ",", "Context", "$", "context", ")", "{", "if", "(", "is_array", "(", "$", "translatable", ")", "&&", "em...
Serialize Translatable to JSON @param JsonSerializationVisitor $visitor Visitor @param Translatable $translatable translatable @param array $type Type @param Context $context Context @return string|null
[ "Serialize", "Translatable", "to", "JSON" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Serializer/Handler/TranslatableHandler.php#L47-L73
26,410
libgraviton/graviton
src/Graviton/I18nBundle/Serializer/Handler/TranslatableHandler.php
TranslatableHandler.deserializeTranslatableFromJson
public function deserializeTranslatableFromJson( JsonDeserializationVisitor $visitor, $data, array $type, Context $context ) { if (!is_null($data)) { $translatable = Translatable::createFromTranslations($data); $this->utils->persistTranslatable($transl...
php
public function deserializeTranslatableFromJson( JsonDeserializationVisitor $visitor, $data, array $type, Context $context ) { if (!is_null($data)) { $translatable = Translatable::createFromTranslations($data); $this->utils->persistTranslatable($transl...
[ "public", "function", "deserializeTranslatableFromJson", "(", "JsonDeserializationVisitor", "$", "visitor", ",", "$", "data", ",", "array", "$", "type", ",", "Context", "$", "context", ")", "{", "if", "(", "!", "is_null", "(", "$", "data", ")", ")", "{", "...
Serialize Translatable from JSON @param JsonDeserializationVisitor $visitor Visitor @param array $data translation array as we represent if to users @param array $type Type @param Context $context Context @return Translatable|null
[ "Serialize", "Translatable", "from", "JSON" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Serializer/Handler/TranslatableHandler.php#L85-L97
26,411
libgraviton/graviton
src/Graviton/BundleBundle/DependencyInjection/GravitonBundleExtension.php
GravitonBundleExtension.loadFiles
private function loadFiles($dir, ContainerBuilder $container, array $allowed) { $locator = new FileLocator($dir); $xmlLoader = new Loader\XmlFileLoader($container, $locator); $ymlLoader = new Loader\YamlFileLoader($container, $locator); $finder = new Finder(); $finder->files...
php
private function loadFiles($dir, ContainerBuilder $container, array $allowed) { $locator = new FileLocator($dir); $xmlLoader = new Loader\XmlFileLoader($container, $locator); $ymlLoader = new Loader\YamlFileLoader($container, $locator); $finder = new Finder(); $finder->files...
[ "private", "function", "loadFiles", "(", "$", "dir", ",", "ContainerBuilder", "$", "container", ",", "array", "$", "allowed", ")", "{", "$", "locator", "=", "new", "FileLocator", "(", "$", "dir", ")", ";", "$", "xmlLoader", "=", "new", "Loader", "\\", ...
Load config files, xml or yml. If will only include the config file if it's in the allowed array. @param string $dir folder @param ContainerBuilder $container Sf container @param array $allowed array of files to load @return void
[ "Load", "config", "files", "xml", "or", "yml", ".", "If", "will", "only", "include", "the", "config", "file", "if", "it", "s", "in", "the", "allowed", "array", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/BundleBundle/DependencyInjection/GravitonBundleExtension.php#L88-L108
26,412
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/BundeBundleUnloadCommand.php
BundeBundleUnloadCommand.getContentData
private function getContentData($content) { $res = []; $res['startStringPos'] = strpos($content, $this->startString) + strlen($this->startString); $res['endStringPos'] = strpos($content, $this->endString); $res['bundleList'] = substr($content, $res['startStringPos'], ($res['endString...
php
private function getContentData($content) { $res = []; $res['startStringPos'] = strpos($content, $this->startString) + strlen($this->startString); $res['endStringPos'] = strpos($content, $this->endString); $res['bundleList'] = substr($content, $res['startStringPos'], ($res['endString...
[ "private", "function", "getContentData", "(", "$", "content", ")", "{", "$", "res", "=", "[", "]", ";", "$", "res", "[", "'startStringPos'", "]", "=", "strpos", "(", "$", "content", ",", "$", "this", "->", "startString", ")", "+", "strlen", "(", "$",...
gets our positions and the bundlelist @param string $content the bundlebundle content @return array data
[ "gets", "our", "positions", "and", "the", "bundlelist" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/BundeBundleUnloadCommand.php#L136-L143
26,413
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/BundeBundleUnloadCommand.php
BundeBundleUnloadCommand.getNewContent
private function getNewContent($content, array $newBundleList) { $contentData = $this->getContentData($content); $beforePart = substr($content, 0, $contentData['startStringPos']); $endPart = substr($content, $contentData['endStringPos']); return $beforePart.PHP_EOL.implode(','.PHP_...
php
private function getNewContent($content, array $newBundleList) { $contentData = $this->getContentData($content); $beforePart = substr($content, 0, $contentData['startStringPos']); $endPart = substr($content, $contentData['endStringPos']); return $beforePart.PHP_EOL.implode(','.PHP_...
[ "private", "function", "getNewContent", "(", "$", "content", ",", "array", "$", "newBundleList", ")", "{", "$", "contentData", "=", "$", "this", "->", "getContentData", "(", "$", "content", ")", ";", "$", "beforePart", "=", "substr", "(", "$", "content", ...
replaces the stuff in the content @param string $content the bundlebundle content @param array $newBundleList new bundle list @return string new content
[ "replaces", "the", "stuff", "in", "the", "content" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/BundeBundleUnloadCommand.php#L153-L161
26,414
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/BundeBundleUnloadCommand.php
BundeBundleUnloadCommand.filterBundleList
private function filterBundleList(array $bundleList) { $groups = []; foreach ($_ENV as $name => $val) { if (substr($name, 0, strlen($this->envDynGroupPrefix)) == $this->envDynGroupPrefix) { $groups[substr($name, strlen($this->envDynGroupPrefix))] = $val; } ...
php
private function filterBundleList(array $bundleList) { $groups = []; foreach ($_ENV as $name => $val) { if (substr($name, 0, strlen($this->envDynGroupPrefix)) == $this->envDynGroupPrefix) { $groups[substr($name, strlen($this->envDynGroupPrefix))] = $val; } ...
[ "private", "function", "filterBundleList", "(", "array", "$", "bundleList", ")", "{", "$", "groups", "=", "[", "]", ";", "foreach", "(", "$", "_ENV", "as", "$", "name", "=>", "$", "val", ")", "{", "if", "(", "substr", "(", "$", "name", ",", "0", ...
filters the bundlelist according to ENV vars @param array $bundleList bundle list @return array filtered bundle list
[ "filters", "the", "bundlelist", "according", "to", "ENV", "vars" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/BundeBundleUnloadCommand.php#L170-L201
26,415
libgraviton/graviton
src/Graviton/DocumentBundle/Serializer/Handler/ExtReferenceHandler.php
ExtReferenceHandler.validateExtRef
public function validateExtRef(ConstraintEventFormat $event) { $schema = $event->getSchema(); if (!isset($schema->format) || (isset($schema->format) && $schema->format != 'extref')) { return; } $value = $event->getElement(); // 1st) can it be converted to extre...
php
public function validateExtRef(ConstraintEventFormat $event) { $schema = $event->getSchema(); if (!isset($schema->format) || (isset($schema->format) && $schema->format != 'extref')) { return; } $value = $event->getElement(); // 1st) can it be converted to extre...
[ "public", "function", "validateExtRef", "(", "ConstraintEventFormat", "$", "event", ")", "{", "$", "schema", "=", "$", "event", "->", "getSchema", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "schema", "->", "format", ")", "||", "(", "isset", "(",...
Schema validation function for extref values. Will be executed when a user submits an extref @param ConstraintEventFormat $event event @return void
[ "Schema", "validation", "function", "for", "extref", "values", ".", "Will", "be", "executed", "when", "a", "user", "submits", "an", "extref" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/Serializer/Handler/ExtReferenceHandler.php#L98-L147
26,416
libgraviton/graviton
src/Graviton/ProxyBundle/Definition/Loader/LoaderFactory.php
LoaderFactory.getLoaderDefinition
public function getLoaderDefinition($key) { if (array_key_exists($key, $this->loader)) { return $this->loader[$key]; } return null; }
php
public function getLoaderDefinition($key) { if (array_key_exists($key, $this->loader)) { return $this->loader[$key]; } return null; }
[ "public", "function", "getLoaderDefinition", "(", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "loader", ")", ")", "{", "return", "$", "this", "->", "loader", "[", "$", "key", "]", ";", "}", "return", ...
Provides the definition loader identified by the given key. @param string $key Name of the loader to be returned @return LoaderInterface|null
[ "Provides", "the", "definition", "loader", "identified", "by", "the", "given", "key", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Definition/Loader/LoaderFactory.php#L44-L51
26,417
libgraviton/graviton
src/Graviton/SchemaBundle/Serializer/Handler/SchemaEnumHandler.php
SchemaEnumHandler.serializeSchemaEnumToJson
public function serializeSchemaEnumToJson( JsonSerializationVisitor $visitor, SchemaEnum $schemaEnum, array $type, Context $context ) { return $schemaEnum->getValues(); }
php
public function serializeSchemaEnumToJson( JsonSerializationVisitor $visitor, SchemaEnum $schemaEnum, array $type, Context $context ) { return $schemaEnum->getValues(); }
[ "public", "function", "serializeSchemaEnumToJson", "(", "JsonSerializationVisitor", "$", "visitor", ",", "SchemaEnum", "$", "schemaEnum", ",", "array", "$", "type", ",", "Context", "$", "context", ")", "{", "return", "$", "schemaEnum", "->", "getValues", "(", ")...
Serialize SchemaEnum to JSON @param JsonSerializationVisitor $visitor Visitor @param SchemaEnum $schemaEnum enum @param array $type Type @param Context $context Context @return array
[ "Serialize", "SchemaEnum", "to", "JSON" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Serializer/Handler/SchemaEnumHandler.php#L30-L37
26,418
libgraviton/graviton
src/Graviton/DocumentBundle/Serializer/Listener/EmptyExtRefListener.php
EmptyExtRefListener.onPreSerialize
public function onPreSerialize(PreSerializeEvent $event) { $object = $event->getObject(); if ($object instanceof ExtRefHoldingDocumentInterface && $object->isEmptyExtRefObject() === true) { $event->setType('Empty', [$object]); } }
php
public function onPreSerialize(PreSerializeEvent $event) { $object = $event->getObject(); if ($object instanceof ExtRefHoldingDocumentInterface && $object->isEmptyExtRefObject() === true) { $event->setType('Empty', [$object]); } }
[ "public", "function", "onPreSerialize", "(", "PreSerializeEvent", "$", "event", ")", "{", "$", "object", "=", "$", "event", "->", "getObject", "(", ")", ";", "if", "(", "$", "object", "instanceof", "ExtRefHoldingDocumentInterface", "&&", "$", "object", "->", ...
if is empty extref object, divert serializing to type Empty, which creates a null instead of empty object @param PreSerializeEvent $event event @return void @throws \Exception
[ "if", "is", "empty", "extref", "object", "divert", "serializing", "to", "type", "Empty", "which", "creates", "a", "null", "instead", "of", "empty", "object" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/Serializer/Listener/EmptyExtRefListener.php#L28-L34
26,419
libgraviton/graviton
src/Graviton/SecurityBundle/Authentication/Strategies/SameSubnetStrategy.php
SameSubnetStrategy.apply
public function apply(Request $request) { if (IpUtils::checkIp($request->getClientIp(), $this->subnet)) { $name = $this->extractFieldInfo($request->headers, $this->headerField); if (!empty($name)) { return $name; } } return ''; }
php
public function apply(Request $request) { if (IpUtils::checkIp($request->getClientIp(), $this->subnet)) { $name = $this->extractFieldInfo($request->headers, $this->headerField); if (!empty($name)) { return $name; } } return ''; }
[ "public", "function", "apply", "(", "Request", "$", "request", ")", "{", "if", "(", "IpUtils", "::", "checkIp", "(", "$", "request", "->", "getClientIp", "(", ")", ",", "$", "this", "->", "subnet", ")", ")", "{", "$", "name", "=", "$", "this", "->"...
Applies the defined strategy on the provided request. @param Request $request request to handle @return string
[ "Applies", "the", "defined", "strategy", "on", "the", "provided", "request", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Authentication/Strategies/SameSubnetStrategy.php#L54-L64
26,420
konduto/php-sdk
src/Models/BaseModel.php
BaseModel.get
public function get($field) { return key_exists($field, $this->_properties) ? $this->_properties[$field] : null; }
php
public function get($field) { return key_exists($field, $this->_properties) ? $this->_properties[$field] : null; }
[ "public", "function", "get", "(", "$", "field", ")", "{", "return", "key_exists", "(", "$", "field", ",", "$", "this", "->", "_properties", ")", "?", "$", "this", "->", "_properties", "[", "$", "field", "]", ":", "null", ";", "}" ]
Return the value of the field. @param string $field @return mixed
[ "Return", "the", "value", "of", "the", "field", "." ]
ff095590c30307897c557f980845f613ff351585
https://github.com/konduto/php-sdk/blob/ff095590c30307897c557f980845f613ff351585/src/Models/BaseModel.php#L52-L54
26,421
konduto/php-sdk
src/Models/BaseModel.php
BaseModel.addField
public function addField($field, $value=null) { $this->fields[] = $field; if ($value != null) $this->set($field, $value); }
php
public function addField($field, $value=null) { $this->fields[] = $field; if ($value != null) $this->set($field, $value); }
[ "public", "function", "addField", "(", "$", "field", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "fields", "[", "]", "=", "$", "field", ";", "if", "(", "$", "value", "!=", "null", ")", "$", "this", "->", "set", "(", "$", "field...
Add a new field that can be enter in the json array representation of the model. @param string $field name of the field @param mixed $value a value to be set
[ "Add", "a", "new", "field", "that", "can", "be", "enter", "in", "the", "json", "array", "representation", "of", "the", "model", "." ]
ff095590c30307897c557f980845f613ff351585
https://github.com/konduto/php-sdk/blob/ff095590c30307897c557f980845f613ff351585/src/Models/BaseModel.php#L62-L65
26,422
libgraviton/graviton
src/Graviton/AnalyticsBundle/Manager/AnalyticsManager.php
AnalyticsManager.convertData
private function convertData(array $data = null) { if (!is_array($data)) { return $data; } foreach ($data as $key => $val) { /** convert dbrefs */ if (is_array($val) && isset($val['$ref']) && isset($val['$id'])) { $data[$key] = $this->conv...
php
private function convertData(array $data = null) { if (!is_array($data)) { return $data; } foreach ($data as $key => $val) { /** convert dbrefs */ if (is_array($val) && isset($val['$ref']) && isset($val['$id'])) { $data[$key] = $this->conv...
[ "private", "function", "convertData", "(", "array", "$", "data", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "data", ")", ")", "{", "return", "$", "data", ";", "}", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "val",...
convert various things in the data that should be rendered differently @param array $data data @return array data with changed things
[ "convert", "various", "things", "in", "the", "data", "that", "should", "be", "rendered", "differently" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Manager/AnalyticsManager.php#L145-L171
26,423
libgraviton/graviton
src/Graviton/AnalyticsBundle/Manager/AnalyticsManager.php
AnalyticsManager.resolveObject
private function resolveObject($collection, $id) { return $this->connection->selectCollection($this->databaseName, $collection)->findOne(['_id' => $id]); }
php
private function resolveObject($collection, $id) { return $this->connection->selectCollection($this->databaseName, $collection)->findOne(['_id' => $id]); }
[ "private", "function", "resolveObject", "(", "$", "collection", ",", "$", "id", ")", "{", "return", "$", "this", "->", "connection", "->", "selectCollection", "(", "$", "this", "->", "databaseName", ",", "$", "collection", ")", "->", "findOne", "(", "[", ...
resolves a dbref array into the actual object @param string $collection collection name @param string $id record id @return array|null record as array or null
[ "resolves", "a", "dbref", "array", "into", "the", "actual", "object" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Manager/AnalyticsManager.php#L181-L184
26,424
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php
JsonDefinitionHash.getDefAsArray
public function getDefAsArray() { return array_replace( [ 'name' => $this->getName(), 'type' => $this->getType(), 'exposedName' => $this->getName(), 'doctrineType' => $this->getTypeDoctrine(), ...
php
public function getDefAsArray() { return array_replace( [ 'name' => $this->getName(), 'type' => $this->getType(), 'exposedName' => $this->getName(), 'doctrineType' => $this->getTypeDoctrine(), ...
[ "public", "function", "getDefAsArray", "(", ")", "{", "return", "array_replace", "(", "[", "'name'", "=>", "$", "this", "->", "getName", "(", ")", ",", "'type'", "=>", "$", "this", "->", "getType", "(", ")", ",", "'exposedName'", "=>", "$", "this", "->...
Returns the definition as array.. @return array the definition
[ "Returns", "the", "definition", "as", "array", ".." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php#L62-L92
26,425
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php
JsonDefinitionHash.isRequired
public function isRequired() { $isRequired = false; // see if on the first level of fields we have a required=true in the definition foreach ($this->fields as $field) { if ($field instanceof JsonDefinitionField && $field->getDef() instanceof Field && ...
php
public function isRequired() { $isRequired = false; // see if on the first level of fields we have a required=true in the definition foreach ($this->fields as $field) { if ($field instanceof JsonDefinitionField && $field->getDef() instanceof Field && ...
[ "public", "function", "isRequired", "(", ")", "{", "$", "isRequired", "=", "false", ";", "// see if on the first level of fields we have a required=true in the definition", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "{", "if", "(", "$", ...
in an 'anonymous' hash situation, we will check if any children are required @return bool if required or not
[ "in", "an", "anonymous", "hash", "situation", "we", "will", "check", "if", "any", "children", "are", "required" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php#L120-L135
26,426
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php
JsonDefinitionHash.cloneFieldDefinition
private function cloneFieldDefinition(Schema\Field $field) { $clone = clone $field; $clone->setName(preg_replace('/^'.preg_quote($this->name, '/').'\.(\d+\.)*/', '', $clone->getName())); return $clone; }
php
private function cloneFieldDefinition(Schema\Field $field) { $clone = clone $field; $clone->setName(preg_replace('/^'.preg_quote($this->name, '/').'\.(\d+\.)*/', '', $clone->getName())); return $clone; }
[ "private", "function", "cloneFieldDefinition", "(", "Schema", "\\", "Field", "$", "field", ")", "{", "$", "clone", "=", "clone", "$", "field", ";", "$", "clone", "->", "setName", "(", "preg_replace", "(", "'/^'", ".", "preg_quote", "(", "$", "this", "->"...
Clone field definition @param Schema\Field $field Field @return Schema\Field
[ "Clone", "field", "definition" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php#L220-L225
26,427
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php
JsonDefinitionHash.processParentRelation
private function processParentRelation(Schema\Relation $relation) { $prefixRegex = '/^'.preg_quote($this->name, '/').'\.(\d+\.)*(?P<sub>.*)/'; if (!preg_match($prefixRegex, $relation->getLocalProperty(), $matches)) { return null; } $clone = clone $relation; $clon...
php
private function processParentRelation(Schema\Relation $relation) { $prefixRegex = '/^'.preg_quote($this->name, '/').'\.(\d+\.)*(?P<sub>.*)/'; if (!preg_match($prefixRegex, $relation->getLocalProperty(), $matches)) { return null; } $clone = clone $relation; $clon...
[ "private", "function", "processParentRelation", "(", "Schema", "\\", "Relation", "$", "relation", ")", "{", "$", "prefixRegex", "=", "'/^'", ".", "preg_quote", "(", "$", "this", "->", "name", ",", "'/'", ")", ".", "'\\.(\\d+\\.)*(?P<sub>.*)/'", ";", "if", "(...
Process parent relation @param Schema\Relation $relation Parent relation @return Schema\Relation|null
[ "Process", "parent", "relation" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php#L233-L243
26,428
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php
JsonDefinitionHash.getClassName
private function getClassName($fq = false) { $className = ucfirst($this->parent->getId()).ucfirst($this->getName()); if ($fq) { $className = $this->parent->getNamespace().'\\Document\\'.$className; } return $className; }
php
private function getClassName($fq = false) { $className = ucfirst($this->parent->getId()).ucfirst($this->getName()); if ($fq) { $className = $this->parent->getNamespace().'\\Document\\'.$className; } return $className; }
[ "private", "function", "getClassName", "(", "$", "fq", "=", "false", ")", "{", "$", "className", "=", "ucfirst", "(", "$", "this", "->", "parent", "->", "getId", "(", ")", ")", ".", "ucfirst", "(", "$", "this", "->", "getName", "(", ")", ")", ";", ...
Returns the class name of this hash, possibly taking the parent element into the name. this string here results in the name of the generated Document. @param boolean $fq if true, we'll return the class name full qualified @return string
[ "Returns", "the", "class", "name", "of", "this", "hash", "possibly", "taking", "the", "parent", "element", "into", "the", "name", ".", "this", "string", "here", "results", "in", "the", "name", "of", "the", "generated", "Document", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/JsonDefinitionHash.php#L254-L262
26,429
libgraviton/graviton
src/Graviton/DocumentBundle/Service/ExtReferenceConverter.php
ExtReferenceConverter.getExtReference
public function getExtReference($url) { $path = parse_url($url, PHP_URL_PATH); if ($path === false) { throw new \InvalidArgumentException(sprintf('URL %s', $url)); } $id = null; $collection = null; if (!isset($this->resolvingCache[$path])) { ...
php
public function getExtReference($url) { $path = parse_url($url, PHP_URL_PATH); if ($path === false) { throw new \InvalidArgumentException(sprintf('URL %s', $url)); } $id = null; $collection = null; if (!isset($this->resolvingCache[$path])) { ...
[ "public", "function", "getExtReference", "(", "$", "url", ")", "{", "$", "path", "=", "parse_url", "(", "$", "url", ",", "PHP_URL_PATH", ")", ";", "if", "(", "$", "path", "===", "false", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", ...
return the extref from URL @param string $url Extref URL @return ExtReference @throws \InvalidArgumentException
[ "return", "the", "extref", "from", "URL" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/Service/ExtReferenceConverter.php#L54-L78
26,430
libgraviton/graviton
src/Graviton/DocumentBundle/Service/ExtReferenceConverter.php
ExtReferenceConverter.getUrl
public function getUrl(ExtReference $extReference) { if (!isset($this->mapping[$extReference->getRef()])) { throw new \InvalidArgumentException( sprintf( 'Could not create URL from extref "%s"', json_encode($extReference) ) ...
php
public function getUrl(ExtReference $extReference) { if (!isset($this->mapping[$extReference->getRef()])) { throw new \InvalidArgumentException( sprintf( 'Could not create URL from extref "%s"', json_encode($extReference) ) ...
[ "public", "function", "getUrl", "(", "ExtReference", "$", "extReference", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "mapping", "[", "$", "extReference", "->", "getRef", "(", ")", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgume...
return the URL from extref @param ExtReference $extReference Extref @return string @throws \InvalidArgumentException
[ "return", "the", "URL", "from", "extref" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/Service/ExtReferenceConverter.php#L87-L103
26,431
libgraviton/graviton
src/Graviton/DocumentBundle/Service/ExtReferenceConverter.php
ExtReferenceConverter.getDataFromRoute
private function getDataFromRoute(Route $route, $value) { if ($route->getRequirement('id') !== null && $route->getMethods() === ['GET'] && preg_match($route->compile()->getRegex(), $value, $matches) ) { $id = $matches['id']; list($routeService) = expl...
php
private function getDataFromRoute(Route $route, $value) { if ($route->getRequirement('id') !== null && $route->getMethods() === ['GET'] && preg_match($route->compile()->getRegex(), $value, $matches) ) { $id = $matches['id']; list($routeService) = expl...
[ "private", "function", "getDataFromRoute", "(", "Route", "$", "route", ",", "$", "value", ")", "{", "if", "(", "$", "route", "->", "getRequirement", "(", "'id'", ")", "!==", "null", "&&", "$", "route", "->", "getMethods", "(", ")", "===", "[", "'GET'",...
get collection and id from route @param Route $route route to look at @param string $value value of reference as URI @return array
[ "get", "collection", "and", "id", "from", "route" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/Service/ExtReferenceConverter.php#L113-L130
26,432
libgraviton/graviton
src/Graviton/RabbitMqBundle/DependencyInjection/GravitonRabbitMqExtension.php
GravitonRabbitMqExtension.prepend
public function prepend(ContainerBuilder $container) { parent::prepend($container); // populated from cf's VCAP_SERVICES variable $services = getenv('VCAP_SERVICES'); if (!empty($services)) { $services = json_decode($services, true); if (!isset($services['ra...
php
public function prepend(ContainerBuilder $container) { parent::prepend($container); // populated from cf's VCAP_SERVICES variable $services = getenv('VCAP_SERVICES'); if (!empty($services)) { $services = json_decode($services, true); if (!isset($services['ra...
[ "public", "function", "prepend", "(", "ContainerBuilder", "$", "container", ")", "{", "parent", "::", "prepend", "(", "$", "container", ")", ";", "// populated from cf's VCAP_SERVICES variable", "$", "services", "=", "getenv", "(", "'VCAP_SERVICES'", ")", ";", "if...
Overwrite rabbitmq config from cloud if available @param ContainerBuilder $container instance @return void
[ "Overwrite", "rabbitmq", "config", "from", "cloud", "if", "available" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RabbitMqBundle/DependencyInjection/GravitonRabbitMqExtension.php#L35-L61
26,433
SimpleBus/DoctrineORMBridge
src/EventListener/CollectsEventsFromEntities.php
CollectsEventsFromEntities.postFlush
public function postFlush(PostFlushEventArgs $eventArgs) { $em = $eventArgs->getEntityManager(); $uow = $em->getUnitOfWork(); foreach ($uow->getIdentityMap() as $entities) { foreach ($entities as $entity){ $this->collectEventsFromEntity($entity); } ...
php
public function postFlush(PostFlushEventArgs $eventArgs) { $em = $eventArgs->getEntityManager(); $uow = $em->getUnitOfWork(); foreach ($uow->getIdentityMap() as $entities) { foreach ($entities as $entity){ $this->collectEventsFromEntity($entity); } ...
[ "public", "function", "postFlush", "(", "PostFlushEventArgs", "$", "eventArgs", ")", "{", "$", "em", "=", "$", "eventArgs", "->", "getEntityManager", "(", ")", ";", "$", "uow", "=", "$", "em", "->", "getUnitOfWork", "(", ")", ";", "foreach", "(", "$", ...
We need to listen on postFlush for Lifecycle Events All Lifecycle callback events are triggered after the onFlush event @param PostFlushEventArgs $eventArgs
[ "We", "need", "to", "listen", "on", "postFlush", "for", "Lifecycle", "Events", "All", "Lifecycle", "callback", "events", "are", "triggered", "after", "the", "onFlush", "event" ]
f372224d3434f166b36c3826cb2d54aaf4c2f717
https://github.com/SimpleBus/DoctrineORMBridge/blob/f372224d3434f166b36c3826cb2d54aaf4c2f717/src/EventListener/CollectsEventsFromEntities.php#L44-L53
26,434
libgraviton/graviton
src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php
ApiDefinitionLoader.getDefinitionLoader
public function getDefinitionLoader() { if (empty($this->definitionLoader) && array_key_exists('prefix', $this->options)) { $this->definitionLoader = $this->loaderFactory->create($this->options['prefix']); } return $this->definitionLoader; }
php
public function getDefinitionLoader() { if (empty($this->definitionLoader) && array_key_exists('prefix', $this->options)) { $this->definitionLoader = $this->loaderFactory->create($this->options['prefix']); } return $this->definitionLoader; }
[ "public", "function", "getDefinitionLoader", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "definitionLoader", ")", "&&", "array_key_exists", "(", "'prefix'", ",", "$", "this", "->", "options", ")", ")", "{", "$", "this", "->", "definitionLoad...
Provides the definition loader instance. @return LoaderInterface
[ "Provides", "the", "definition", "loader", "instance", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php#L74-L81
26,435
libgraviton/graviton
src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php
ApiDefinitionLoader.getEndpointSchema
public function getEndpointSchema($endpoint, $forceReload = false) { $this->loadApiDefinition($forceReload); return $this->definition->getSchema($endpoint); }
php
public function getEndpointSchema($endpoint, $forceReload = false) { $this->loadApiDefinition($forceReload); return $this->definition->getSchema($endpoint); }
[ "public", "function", "getEndpointSchema", "(", "$", "endpoint", ",", "$", "forceReload", "=", "false", ")", "{", "$", "this", "->", "loadApiDefinition", "(", "$", "forceReload", ")", ";", "return", "$", "this", "->", "definition", "->", "getSchema", "(", ...
get a schema for one endpoint @param string $endpoint endpoint @param bool $forceReload Switch to force a new api definition object will be provided. @return \stdClass
[ "get", "a", "schema", "for", "one", "endpoint" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php#L140-L145
26,436
libgraviton/graviton
src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php
ApiDefinitionLoader.getEndpoint
public function getEndpoint($endpoint, $withHost = false, $forceReload = false) { $this->loadApiDefinition($forceReload); $url = ""; if ($withHost) { $url = empty($this->options['host']) ? $this->definition->getHost() : $this->options['host']; } // If the base pa...
php
public function getEndpoint($endpoint, $withHost = false, $forceReload = false) { $this->loadApiDefinition($forceReload); $url = ""; if ($withHost) { $url = empty($this->options['host']) ? $this->definition->getHost() : $this->options['host']; } // If the base pa...
[ "public", "function", "getEndpoint", "(", "$", "endpoint", ",", "$", "withHost", "=", "false", ",", "$", "forceReload", "=", "false", ")", "{", "$", "this", "->", "loadApiDefinition", "(", "$", "forceReload", ")", ";", "$", "url", "=", "\"\"", ";", "if...
get an endpoint @param string $endpoint endpoint @param boolean $withHost attach host name to the url @param bool $forceReload Switch to force a new api definition object will be provided. @return string
[ "get", "an", "endpoint" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php#L156-L168
26,437
libgraviton/graviton
src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php
ApiDefinitionLoader.getAllEndpoints
public function getAllEndpoints($withHost = false, $forceReload = false) { $this->loadApiDefinition($forceReload); $host = empty($this->options['host']) ? '' : $this->options['host']; $prefix = self::PROXY_ROUTE; if (isset($this->options['prefix'])) { $prefix .= "/".$thi...
php
public function getAllEndpoints($withHost = false, $forceReload = false) { $this->loadApiDefinition($forceReload); $host = empty($this->options['host']) ? '' : $this->options['host']; $prefix = self::PROXY_ROUTE; if (isset($this->options['prefix'])) { $prefix .= "/".$thi...
[ "public", "function", "getAllEndpoints", "(", "$", "withHost", "=", "false", ",", "$", "forceReload", "=", "false", ")", "{", "$", "this", "->", "loadApiDefinition", "(", "$", "forceReload", ")", ";", "$", "host", "=", "empty", "(", "$", "this", "->", ...
get all endpoints for an API @param boolean $withHost attach host name to the url @param bool $forceReload Switch to force a new api definition object will be provided. @return array
[ "get", "all", "endpoints", "for", "an", "API" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php#L178-L194
26,438
libgraviton/graviton
src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php
ApiDefinitionLoader.loadApiDefinition
private function loadApiDefinition($forceReload = false) { $definitionLoader = $this->getDefinitionLoader(); $supported = $definitionLoader->supports($this->options['uri']); if ($forceReload || ($this->definition == null && $supported)) { $this->definition = $definitionLoader->...
php
private function loadApiDefinition($forceReload = false) { $definitionLoader = $this->getDefinitionLoader(); $supported = $definitionLoader->supports($this->options['uri']); if ($forceReload || ($this->definition == null && $supported)) { $this->definition = $definitionLoader->...
[ "private", "function", "loadApiDefinition", "(", "$", "forceReload", "=", "false", ")", "{", "$", "definitionLoader", "=", "$", "this", "->", "getDefinitionLoader", "(", ")", ";", "$", "supported", "=", "$", "definitionLoader", "->", "supports", "(", "$", "t...
internal load method @param bool $forceReload Switch to force a new api definition object will be provided. @return void
[ "internal", "load", "method" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Service/ApiDefinitionLoader.php#L203-L214
26,439
libgraviton/graviton
src/Graviton/RestBundle/Listener/WriteLockListener.php
WriteLockListener.onKernelController
public function onKernelController(FilterControllerEvent $event) { $currentMethod = $this->requestStack->getCurrentRequest()->getMethod(); // ignore not defined methods.. if (!in_array($currentMethod, $this->interestedMethods)) { return; } $url = $this->requestS...
php
public function onKernelController(FilterControllerEvent $event) { $currentMethod = $this->requestStack->getCurrentRequest()->getMethod(); // ignore not defined methods.. if (!in_array($currentMethod, $this->interestedMethods)) { return; } $url = $this->requestS...
[ "public", "function", "onKernelController", "(", "FilterControllerEvent", "$", "event", ")", "{", "$", "currentMethod", "=", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(", ")", "->", "getMethod", "(", ")", ";", "// ignore not defined methods..", ...
all "waiting" methods wait until no lock is around.. "writelock" methods wait and create a lock @param FilterControllerEvent $event response listener event @return void
[ "all", "waiting", "methods", "wait", "until", "no", "lock", "is", "around", "..", "writelock", "methods", "wait", "and", "create", "a", "lock" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/WriteLockListener.php#L118-L159
26,440
libgraviton/graviton
src/Graviton/RestBundle/Listener/WriteLockListener.php
WriteLockListener.doRandomDelay
private function doRandomDelay($url) { return array_reduce( $this->randomWaitUrls, function ($carry, $value) use ($url) { if ($carry !== true) { return (strpos($url, $value) === 0); } else { return $carry; ...
php
private function doRandomDelay($url) { return array_reduce( $this->randomWaitUrls, function ($carry, $value) use ($url) { if ($carry !== true) { return (strpos($url, $value) === 0); } else { return $carry; ...
[ "private", "function", "doRandomDelay", "(", "$", "url", ")", "{", "return", "array_reduce", "(", "$", "this", "->", "randomWaitUrls", ",", "function", "(", "$", "carry", ",", "$", "value", ")", "use", "(", "$", "url", ")", "{", "if", "(", "$", "carr...
if we should randomly wait on current request @param string $url the current url @return boolean true if yes, false otherwise
[ "if", "we", "should", "randomly", "wait", "on", "current", "request" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/WriteLockListener.php#L184-L196
26,441
libgraviton/graviton
src/Graviton/ProxyBundle/Controller/ProxyController.php
ProxyController.proxyAction
public function proxyAction(Request $request) { $api = $this->decideApiAndEndpoint($request->getUri()); $this->registerProxySources($api['apiName']); $this->apiLoader->addOptions($api); $url = new Uri($this->apiLoader->getEndpoint($api['endpoint'], true)); if ($url->getSche...
php
public function proxyAction(Request $request) { $api = $this->decideApiAndEndpoint($request->getUri()); $this->registerProxySources($api['apiName']); $this->apiLoader->addOptions($api); $url = new Uri($this->apiLoader->getEndpoint($api['endpoint'], true)); if ($url->getSche...
[ "public", "function", "proxyAction", "(", "Request", "$", "request", ")", "{", "$", "api", "=", "$", "this", "->", "decideApiAndEndpoint", "(", "$", "request", "->", "getUri", "(", ")", ")", ";", "$", "this", "->", "registerProxySources", "(", "$", "api"...
action for routing all requests directly to the third party API @param Request $request request @return \Psr\Http\Message\ResponseInterface|Response
[ "action", "for", "routing", "all", "requests", "directly", "to", "the", "third", "party", "API" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Controller/ProxyController.php#L107-L178
26,442
libgraviton/graviton
src/Graviton/ProxyBundle/Controller/ProxyController.php
ProxyController.cleanResponseHeaders
protected function cleanResponseHeaders(HeaderBag $headers) { $headers->remove('transfer-encoding'); // Chunked responses get not automatically re-chunked by graviton $headers->remove('trailer'); // Only for chunked responses, graviton should re-set this when chunking // Change naming to Gr...
php
protected function cleanResponseHeaders(HeaderBag $headers) { $headers->remove('transfer-encoding'); // Chunked responses get not automatically re-chunked by graviton $headers->remove('trailer'); // Only for chunked responses, graviton should re-set this when chunking // Change naming to Gr...
[ "protected", "function", "cleanResponseHeaders", "(", "HeaderBag", "$", "headers", ")", "{", "$", "headers", "->", "remove", "(", "'transfer-encoding'", ")", ";", "// Chunked responses get not automatically re-chunked by graviton", "$", "headers", "->", "remove", "(", "...
Removes some headers from the thirdparty API's response. These headers get always invalid by graviton's forwarding and should therefore not be delivered to the client. @param HeaderBag $headers The headerbag holding the thirdparty API's response headers @return void
[ "Removes", "some", "headers", "from", "the", "thirdparty", "API", "s", "response", ".", "These", "headers", "get", "always", "invalid", "by", "graviton", "s", "forwarding", "and", "should", "therefore", "not", "be", "delivered", "to", "the", "client", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Controller/ProxyController.php#L188-L198
26,443
libgraviton/graviton
src/Graviton/ProxyBundle/Controller/ProxyController.php
ProxyController.schemaAction
public function schemaAction(Request $request) { $api = $this->decideApiAndEndpoint($request->getUri()); $this->registerProxySources($api['apiName']); $this->apiLoader->addOptions($api); $schema = $this->apiLoader->getEndpointSchema(urldecode($api['endpoint'])); $schema = $t...
php
public function schemaAction(Request $request) { $api = $this->decideApiAndEndpoint($request->getUri()); $this->registerProxySources($api['apiName']); $this->apiLoader->addOptions($api); $schema = $this->apiLoader->getEndpointSchema(urldecode($api['endpoint'])); $schema = $t...
[ "public", "function", "schemaAction", "(", "Request", "$", "request", ")", "{", "$", "api", "=", "$", "this", "->", "decideApiAndEndpoint", "(", "$", "request", "->", "getUri", "(", ")", ")", ";", "$", "this", "->", "registerProxySources", "(", "$", "api...
get schema info @param Request $request request @return Response
[ "get", "schema", "info" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Controller/ProxyController.php#L207-L228
26,444
libgraviton/graviton
src/Graviton/ProxyBundle/Controller/ProxyController.php
ProxyController.registerProxySources
private function registerProxySources($apiPrefix = '') { foreach (array_keys($this->proxySourceConfiguration) as $source) { foreach ($this->proxySourceConfiguration[$source] as $config) { if ($apiPrefix == $config['prefix']) { $this->apiLoader->setOption($conf...
php
private function registerProxySources($apiPrefix = '') { foreach (array_keys($this->proxySourceConfiguration) as $source) { foreach ($this->proxySourceConfiguration[$source] as $config) { if ($apiPrefix == $config['prefix']) { $this->apiLoader->setOption($conf...
[ "private", "function", "registerProxySources", "(", "$", "apiPrefix", "=", "''", ")", "{", "foreach", "(", "array_keys", "(", "$", "this", "->", "proxySourceConfiguration", ")", "as", "$", "source", ")", "{", "foreach", "(", "$", "this", "->", "proxySourceCo...
Registers configured external services to be proxied. @param string $apiPrefix The prefix of the API @return void
[ "Registers", "configured", "external", "services", "to", "be", "proxied", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Controller/ProxyController.php#L265-L279
26,445
libgraviton/graviton
src/Graviton/ProxyBundle/Controller/ProxyController.php
ProxyController.getHostWithScheme
private function getHostWithScheme(UriInterface $url) { $target = new Uri(); $target = $target ->withScheme($url->getScheme()) ->withHost($url->getHost()) ->withPort($url->getPort()); return (string) $target; }
php
private function getHostWithScheme(UriInterface $url) { $target = new Uri(); $target = $target ->withScheme($url->getScheme()) ->withHost($url->getHost()) ->withPort($url->getPort()); return (string) $target; }
[ "private", "function", "getHostWithScheme", "(", "UriInterface", "$", "url", ")", "{", "$", "target", "=", "new", "Uri", "(", ")", ";", "$", "target", "=", "$", "target", "->", "withScheme", "(", "$", "url", "->", "getScheme", "(", ")", ")", "->", "w...
get host, scheme and port @param string $url the url @return string
[ "get", "host", "scheme", "and", "port" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Controller/ProxyController.php#L288-L297
26,446
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/Loader/Loader.php
Loader.load
public function load($input) { foreach ($this->strategies as $strategy) { if ($strategy->supports($input)) { return array_map([$this, 'createJsonDefinition'], $strategy->load($input)); } } return []; }
php
public function load($input) { foreach ($this->strategies as $strategy) { if ($strategy->supports($input)) { return array_map([$this, 'createJsonDefinition'], $strategy->load($input)); } } return []; }
[ "public", "function", "load", "(", "$", "input", ")", "{", "foreach", "(", "$", "this", "->", "strategies", "as", "$", "strategy", ")", "{", "if", "(", "$", "strategy", "->", "supports", "(", "$", "input", ")", ")", "{", "return", "array_map", "(", ...
load from input @param string|null $input input from command @return JsonDefinition[]
[ "load", "from", "input" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/Loader/Loader.php#L72-L81
26,447
libgraviton/graviton
src/Graviton/GeneratorBundle/Definition/Loader/Loader.php
Loader.createJsonDefinition
protected function createJsonDefinition($json) { $errors = $this->validator->validateJsonDefinition($json); if (!empty($errors)) { throw new ValidationException($errors); } $definition = $this->serializer->deserialize( $json, 'Graviton\\GeneratorB...
php
protected function createJsonDefinition($json) { $errors = $this->validator->validateJsonDefinition($json); if (!empty($errors)) { throw new ValidationException($errors); } $definition = $this->serializer->deserialize( $json, 'Graviton\\GeneratorB...
[ "protected", "function", "createJsonDefinition", "(", "$", "json", ")", "{", "$", "errors", "=", "$", "this", "->", "validator", "->", "validateJsonDefinition", "(", "$", "json", ")", ";", "if", "(", "!", "empty", "(", "$", "errors", ")", ")", "{", "th...
Deserialize JSON definition @param string $json JSON code @return JsonDefinition @throws InvalidJsonException If JSON is invalid @throws ValidationException If definition is not valid
[ "Deserialize", "JSON", "definition" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Definition/Loader/Loader.php#L91-L105
26,448
libgraviton/graviton
src/Graviton/I18nBundle/Translator/Translator.php
Translator.translate
public function translate($original) { $cached = $this->getFromCache($original); if (is_array($cached)) { return $cached; } $translations = $this->translationCollection->find(['original' => $original])->toArray(); $baseArray = []; foreach ($translations ...
php
public function translate($original) { $cached = $this->getFromCache($original); if (is_array($cached)) { return $cached; } $translations = $this->translationCollection->find(['original' => $original])->toArray(); $baseArray = []; foreach ($translations ...
[ "public", "function", "translate", "(", "$", "original", ")", "{", "$", "cached", "=", "$", "this", "->", "getFromCache", "(", "$", "original", ")", ";", "if", "(", "is_array", "(", "$", "cached", ")", ")", "{", "return", "$", "cached", ";", "}", "...
translate a string, returning an array with translations @param string $original original string @return array translation array
[ "translate", "a", "string", "returning", "an", "array", "with", "translations" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Translator/Translator.php#L79-L108
26,449
libgraviton/graviton
src/Graviton/I18nBundle/Translator/Translator.php
Translator.persistTranslatable
public function persistTranslatable(Translatable $translatable) { $translations = $translatable->getTranslations(); if (!isset($translations[$this->defaultLanguage])) { throw new \LogicException('Not possible to persist a Translatable without default language!'); } $orig...
php
public function persistTranslatable(Translatable $translatable) { $translations = $translatable->getTranslations(); if (!isset($translations[$this->defaultLanguage])) { throw new \LogicException('Not possible to persist a Translatable without default language!'); } $orig...
[ "public", "function", "persistTranslatable", "(", "Translatable", "$", "translatable", ")", "{", "$", "translations", "=", "$", "translatable", "->", "getTranslations", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "translations", "[", "$", "this", "->",...
persists a translatable to database @param Translatable $translatable the translatable @return void
[ "persists", "a", "translatable", "to", "database" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Translator/Translator.php#L127-L152
26,450
libgraviton/graviton
src/Graviton/I18nBundle/Translator/Translator.php
Translator.getLanguages
public function getLanguages() { if (!empty($this->languages)) { return $this->languages; } $this->languages = array_map( function ($record) { return $record['_id']; }, $this->languageCollection->find([], ['_id' => 1])->toArray...
php
public function getLanguages() { if (!empty($this->languages)) { return $this->languages; } $this->languages = array_map( function ($record) { return $record['_id']; }, $this->languageCollection->find([], ['_id' => 1])->toArray...
[ "public", "function", "getLanguages", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "languages", ")", ")", "{", "return", "$", "this", "->", "languages", ";", "}", "$", "this", "->", "languages", "=", "array_map", "(", "function", "...
returns all available languages @return array languages
[ "returns", "all", "available", "languages" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Translator/Translator.php#L159-L177
26,451
libgraviton/graviton
src/Graviton/I18nBundle/Translator/Translator.php
Translator.getFromCache
private function getFromCache($original) { $cacheContent = $this->cache->fetch($this->getCacheKey($original)); if (is_array($cacheContent) && isset($cacheContent[$original])) { return $cacheContent[$original]; } return null; }
php
private function getFromCache($original) { $cacheContent = $this->cache->fetch($this->getCacheKey($original)); if (is_array($cacheContent) && isset($cacheContent[$original])) { return $cacheContent[$original]; } return null; }
[ "private", "function", "getFromCache", "(", "$", "original", ")", "{", "$", "cacheContent", "=", "$", "this", "->", "cache", "->", "fetch", "(", "$", "this", "->", "getCacheKey", "(", "$", "original", ")", ")", ";", "if", "(", "is_array", "(", "$", "...
gets entry from cache @param string $original original string @return array|null entry
[ "gets", "entry", "from", "cache" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Translator/Translator.php#L186-L194
26,452
libgraviton/graviton
src/Graviton/I18nBundle/Translator/Translator.php
Translator.saveToCache
private function saveToCache($original, $translations) { $cacheKey = $this->getCacheKey($original); $cacheContent = $this->cache->fetch($cacheKey); if (is_array($cacheContent)) { $cacheContent[$original] = $translations; } else { $cacheContent = [$original => ...
php
private function saveToCache($original, $translations) { $cacheKey = $this->getCacheKey($original); $cacheContent = $this->cache->fetch($cacheKey); if (is_array($cacheContent)) { $cacheContent[$original] = $translations; } else { $cacheContent = [$original => ...
[ "private", "function", "saveToCache", "(", "$", "original", ",", "$", "translations", ")", "{", "$", "cacheKey", "=", "$", "this", "->", "getCacheKey", "(", "$", "original", ")", ";", "$", "cacheContent", "=", "$", "this", "->", "cache", "->", "fetch", ...
saves entry to cache @param string $original original string @param array $translations translations @return void
[ "saves", "entry", "to", "cache" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Translator/Translator.php#L204-L215
26,453
libgraviton/graviton
src/Graviton/I18nBundle/Translator/Translator.php
Translator.removeFromCache
private function removeFromCache($original) { $cacheKey = $this->getCacheKey($original); $cacheContent = $this->cache->fetch($this->getCacheKey($original)); if (is_array($cacheContent) && isset($cacheContent[$original])) { unset($cacheContent[$original]); $this->cache...
php
private function removeFromCache($original) { $cacheKey = $this->getCacheKey($original); $cacheContent = $this->cache->fetch($this->getCacheKey($original)); if (is_array($cacheContent) && isset($cacheContent[$original])) { unset($cacheContent[$original]); $this->cache...
[ "private", "function", "removeFromCache", "(", "$", "original", ")", "{", "$", "cacheKey", "=", "$", "this", "->", "getCacheKey", "(", "$", "original", ")", ";", "$", "cacheContent", "=", "$", "this", "->", "cache", "->", "fetch", "(", "$", "this", "->...
removes entry from cache @param string $original original string @return void
[ "removes", "entry", "from", "cache" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Translator/Translator.php#L224-L232
26,454
libgraviton/graviton
src/Graviton/I18nBundle/Translator/Translator.php
Translator.getCacheKey
private function getCacheKey($original) { return sprintf( 'translator_%s_%s', implode('.', $this->getLanguages()), str_pad(strtolower(substr($original, 0, $this->cacheNameDepth)), $this->cacheNameDepth, '.') ); }
php
private function getCacheKey($original) { return sprintf( 'translator_%s_%s', implode('.', $this->getLanguages()), str_pad(strtolower(substr($original, 0, $this->cacheNameDepth)), $this->cacheNameDepth, '.') ); }
[ "private", "function", "getCacheKey", "(", "$", "original", ")", "{", "return", "sprintf", "(", "'translator_%s_%s'", ",", "implode", "(", "'.'", ",", "$", "this", "->", "getLanguages", "(", ")", ")", ",", "str_pad", "(", "strtolower", "(", "substr", "(", ...
returns the caching key @param string $original original string @return string cache key
[ "returns", "the", "caching", "key" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/I18nBundle/Translator/Translator.php#L241-L248
26,455
libgraviton/graviton
src/Graviton/RestBundle/HttpFoundation/LinkHeaderItem.php
LinkHeaderItem.fromString
public static function fromString($itemValue) { $bits = preg_split('/(".+?"|[^;]+)(?:;|$)/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $value = array_shift($bits); $attributes = []; foreach ($bits as $bit) { list($bitName, $bitValue) = explode('=', ...
php
public static function fromString($itemValue) { $bits = preg_split('/(".+?"|[^;]+)(?:;|$)/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $value = array_shift($bits); $attributes = []; foreach ($bits as $bit) { list($bitName, $bitValue) = explode('=', ...
[ "public", "static", "function", "fromString", "(", "$", "itemValue", ")", "{", "$", "bits", "=", "preg_split", "(", "'/(\".+?\"|[^;]+)(?:;|$)/'", ",", "$", "itemValue", ",", "0", ",", "PREG_SPLIT_NO_EMPTY", "|", "PREG_SPLIT_DELIM_CAPTURE", ")", ";", "$", "value"...
Builds a LinkHeaderItem instance from a string. @param string $itemValue value of a single link header @return \Graviton\RestBundle\HttpFoundation\LinkHeaderItem
[ "Builds", "a", "LinkHeaderItem", "instance", "from", "a", "string", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/HttpFoundation/LinkHeaderItem.php#L51-L69
26,456
libgraviton/graviton
src/Graviton/RestBundle/HttpFoundation/LinkHeaderItem.php
LinkHeaderItem.trimEdge
private static function trimEdge($string, $char) { if (substr($string, 0, 1) == $char) { $string = substr($string, 1, -1); } return $string; }
php
private static function trimEdge($string, $char) { if (substr($string, 0, 1) == $char) { $string = substr($string, 1, -1); } return $string; }
[ "private", "static", "function", "trimEdge", "(", "$", "string", ",", "$", "char", ")", "{", "if", "(", "substr", "(", "$", "string", ",", "0", ",", "1", ")", "==", "$", "char", ")", "{", "$", "string", "=", "substr", "(", "$", "string", ",", "...
trim edge of string if char maches @param string $string string @param string $char char @return string
[ "trim", "edge", "of", "string", "if", "char", "maches" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/HttpFoundation/LinkHeaderItem.php#L158-L165
26,457
libgraviton/graviton
src/Graviton/SecurityBundle/Authentication/Provider/AuthenticationProviderDummy.php
AuthenticationProviderDummy.loadUserByUsername
public function loadUserByUsername($username) { if ($username !== 'testUsername') { return false; } /** @var UserInterface $user */ $user = new \stdClass(); $user->id = 123; $user->username = $username; $user->firstName = 'aName'; $user->l...
php
public function loadUserByUsername($username) { if ($username !== 'testUsername') { return false; } /** @var UserInterface $user */ $user = new \stdClass(); $user->id = 123; $user->username = $username; $user->firstName = 'aName'; $user->l...
[ "public", "function", "loadUserByUsername", "(", "$", "username", ")", "{", "if", "(", "$", "username", "!==", "'testUsername'", ")", "{", "return", "false", ";", "}", "/** @var UserInterface $user */", "$", "user", "=", "new", "\\", "stdClass", "(", ")", ";...
Dummy loader for test case This method must throw UsernameNotFoundException if the user is not found. @param string $username the consultants username @return false|UserInterface
[ "Dummy", "loader", "for", "test", "case" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Authentication/Provider/AuthenticationProviderDummy.php#L36-L50
26,458
libgraviton/graviton
src/Graviton/RestBundle/Service/QueryService.php
QueryService.hasSearchIndex
private function hasSearchIndex() { $metadata = $this->repository->getClassMetadata(); $indexes = $metadata->getIndexes(); if (empty($indexes)) { return false; } $text = array_filter( $indexes, function ($index) { if (isset...
php
private function hasSearchIndex() { $metadata = $this->repository->getClassMetadata(); $indexes = $metadata->getIndexes(); if (empty($indexes)) { return false; } $text = array_filter( $indexes, function ($index) { if (isset...
[ "private", "function", "hasSearchIndex", "(", ")", "{", "$", "metadata", "=", "$", "this", "->", "repository", "->", "getClassMetadata", "(", ")", ";", "$", "indexes", "=", "$", "metadata", "->", "getIndexes", "(", ")", ";", "if", "(", "empty", "(", "$...
Check if collection has search indexes in DB @return bool
[ "Check", "if", "collection", "has", "search", "indexes", "in", "DB" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/QueryService.php#L246-L270
26,459
libgraviton/graviton
src/Graviton/RestBundle/Service/QueryService.php
QueryService.getPaginationPageSize
private function getPaginationPageSize() { $limitNode = $this->getPaginationLimitNode(); if ($limitNode) { $limit = $limitNode->getLimit(); if ($limit < 1) { throw new SyntaxErrorException('invalid limit in rql'); } return $limit; ...
php
private function getPaginationPageSize() { $limitNode = $this->getPaginationLimitNode(); if ($limitNode) { $limit = $limitNode->getLimit(); if ($limit < 1) { throw new SyntaxErrorException('invalid limit in rql'); } return $limit; ...
[ "private", "function", "getPaginationPageSize", "(", ")", "{", "$", "limitNode", "=", "$", "this", "->", "getPaginationLimitNode", "(", ")", ";", "if", "(", "$", "limitNode", ")", "{", "$", "limit", "=", "$", "limitNode", "->", "getLimit", "(", ")", ";",...
get the pagination page size @return int page size
[ "get", "the", "pagination", "page", "size" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/QueryService.php#L277-L292
26,460
libgraviton/graviton
src/Graviton/RestBundle/Service/QueryService.php
QueryService.getPaginationLimitNode
private function getPaginationLimitNode() { /** @var Query $rqlQuery */ $rqlQuery = $this->request->attributes->get('rqlQuery'); if ($rqlQuery instanceof Query && $rqlQuery->getLimit() instanceof LimitNode) { return $rqlQuery->getLimit(); } return false; }
php
private function getPaginationLimitNode() { /** @var Query $rqlQuery */ $rqlQuery = $this->request->attributes->get('rqlQuery'); if ($rqlQuery instanceof Query && $rqlQuery->getLimit() instanceof LimitNode) { return $rqlQuery->getLimit(); } return false; }
[ "private", "function", "getPaginationLimitNode", "(", ")", "{", "/** @var Query $rqlQuery */", "$", "rqlQuery", "=", "$", "this", "->", "request", "->", "attributes", "->", "get", "(", "'rqlQuery'", ")", ";", "if", "(", "$", "rqlQuery", "instanceof", "Query", ...
gets the limit node @return bool|LimitNode the node or false
[ "gets", "the", "limit", "node" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Service/QueryService.php#L315-L325
26,461
libgraviton/graviton
src/Graviton/FileBundle/Manager/FileManager.php
FileManager.buildGetContentResponse
public function buildGetContentResponse(Response $response, FileDocument $file) { /** @var FileMetadataBase $metadata */ $metadata = $file->getMetadata(); if (!$metadata) { throw new InvalidArgumentException('Loaded file have no valid metadata'); } // We use file...
php
public function buildGetContentResponse(Response $response, FileDocument $file) { /** @var FileMetadataBase $metadata */ $metadata = $file->getMetadata(); if (!$metadata) { throw new InvalidArgumentException('Loaded file have no valid metadata'); } // We use file...
[ "public", "function", "buildGetContentResponse", "(", "Response", "$", "response", ",", "FileDocument", "$", "file", ")", "{", "/** @var FileMetadataBase $metadata */", "$", "metadata", "=", "$", "file", "->", "getMetadata", "(", ")", ";", "if", "(", "!", "$", ...
Will update the response object with provided file data @param Response $response response @param DocumentFile $file File document object from DB @return Response @throws InvalidArgumentException if invalid info fetched from fileSystem
[ "Will", "update", "the", "response", "object", "with", "provided", "file", "data" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/FileBundle/Manager/FileManager.php#L100-L135
26,462
libgraviton/graviton
src/Graviton/FileBundle/Manager/FileManager.php
FileManager.saveFile
public function saveFile($id, $filepath) { // will save using a stream $fp = fopen($filepath, 'r+'); $this->fileSystem->putStream($id, $fp); // close file fclose($fp); }
php
public function saveFile($id, $filepath) { // will save using a stream $fp = fopen($filepath, 'r+'); $this->fileSystem->putStream($id, $fp); // close file fclose($fp); }
[ "public", "function", "saveFile", "(", "$", "id", ",", "$", "filepath", ")", "{", "// will save using a stream", "$", "fp", "=", "fopen", "(", "$", "filepath", ",", "'r+'", ")", ";", "$", "this", "->", "fileSystem", "->", "putStream", "(", "$", "id", "...
Save or update a file @param string $id ID of file @param String $filepath path to the file to save @return void
[ "Save", "or", "update", "a", "file" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/FileBundle/Manager/FileManager.php#L146-L155
26,463
libgraviton/graviton
src/Graviton/FileBundle/Manager/FileManager.php
FileManager.buildFileDocument
private function buildFileDocument(FileDocument $document, $file, $original) { $now = new \DateTime(); // If only a file is posted, check if there is a original object and clone it if ($file && $original && !$document->getMetadata()) { $document = clone $original; } ...
php
private function buildFileDocument(FileDocument $document, $file, $original) { $now = new \DateTime(); // If only a file is posted, check if there is a original object and clone it if ($file && $original && !$document->getMetadata()) { $document = clone $original; } ...
[ "private", "function", "buildFileDocument", "(", "FileDocument", "$", "document", ",", "$", "file", ",", "$", "original", ")", "{", "$", "now", "=", "new", "\\", "DateTime", "(", ")", ";", "// If only a file is posted, check if there is a original object and clone it"...
Create the basic needs for a file @param DocumentFile $document Post or Put file document @param UploadedFile $file To be used in set metadata @param DocumentFile $original If there is a original document @return DocumentFile @throws InvalidArgumentException
[ "Create", "the", "basic", "needs", "for", "a", "file" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/FileBundle/Manager/FileManager.php#L237-L285
26,464
libgraviton/graviton
src/Graviton/FileBundle/Manager/FileManager.php
FileManager.remove
public function remove($id) { if ($this->fileSystem->has($id)) { $this->fileSystem->delete($id); } }
php
public function remove($id) { if ($this->fileSystem->has($id)) { $this->fileSystem->delete($id); } }
[ "public", "function", "remove", "(", "$", "id", ")", "{", "if", "(", "$", "this", "->", "fileSystem", "->", "has", "(", "$", "id", ")", ")", "{", "$", "this", "->", "fileSystem", "->", "delete", "(", "$", "id", ")", ";", "}", "}" ]
Simple delete item from file system @param string $id ID of file to be deleted @return void
[ "Simple", "delete", "item", "from", "file", "system" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/FileBundle/Manager/FileManager.php#L312-L317
26,465
libgraviton/graviton
src/Graviton/FileBundle/Manager/FileManager.php
FileManager.getUploadedFileFromRequest
private function getUploadedFileFromRequest(Request $request) { $file = false; if ($request->files instanceof FileBag && $request->files->count() > 0) { if ($request->files->count() > 1) { throw new InvalidArgumentException('Only 1 file upload per requests allowed.'); ...
php
private function getUploadedFileFromRequest(Request $request) { $file = false; if ($request->files instanceof FileBag && $request->files->count() > 0) { if ($request->files->count() > 1) { throw new InvalidArgumentException('Only 1 file upload per requests allowed.'); ...
[ "private", "function", "getUploadedFileFromRequest", "(", "Request", "$", "request", ")", "{", "$", "file", "=", "false", ";", "if", "(", "$", "request", "->", "files", "instanceof", "FileBag", "&&", "$", "request", "->", "files", "->", "count", "(", ")", ...
Set global uploaded file. Only ONE file allowed per upload. @param Request $request service request @return UploadedFile if file was uploaded @throws InvalidArgumentException
[ "Set", "global", "uploaded", "file", ".", "Only", "ONE", "file", "allowed", "per", "upload", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/FileBundle/Manager/FileManager.php#L327-L343
26,466
libgraviton/graviton
src/Graviton/RestBundle/Controller/RestController.php
RestController.getAction
public function getAction(Request $request, $id) { $document = $this->getModel()->getSerialised($id, $request); $response = $this->getResponse() ->setStatusCode(Response::HTTP_OK) ->setContent($document); return $response; }
php
public function getAction(Request $request, $id) { $document = $this->getModel()->getSerialised($id, $request); $response = $this->getResponse() ->setStatusCode(Response::HTTP_OK) ->setContent($document); return $response; }
[ "public", "function", "getAction", "(", "Request", "$", "request", ",", "$", "id", ")", "{", "$", "document", "=", "$", "this", "->", "getModel", "(", ")", "->", "getSerialised", "(", "$", "id", ",", "$", "request", ")", ";", "$", "response", "=", ...
Returns a single record @param Request $request Current http request @param string $id ID of record @return \Symfony\Component\HttpFoundation\Response $response Response with result or error
[ "Returns", "a", "single", "record" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Controller/RestController.php#L131-L140
26,467
libgraviton/graviton
src/Graviton/RestBundle/Controller/RestController.php
RestController.allAction
public function allAction(Request $request) { $model = $this->getModel(); $content = $this->restUtils->serialize($model->findAll($request)); $response = $this->getResponse() ->setStatusCode(Response::HTTP_OK) ->setContent($content); return $response; }
php
public function allAction(Request $request) { $model = $this->getModel(); $content = $this->restUtils->serialize($model->findAll($request)); $response = $this->getResponse() ->setStatusCode(Response::HTTP_OK) ->setContent($content); return $response; }
[ "public", "function", "allAction", "(", "Request", "$", "request", ")", "{", "$", "model", "=", "$", "this", "->", "getModel", "(", ")", ";", "$", "content", "=", "$", "this", "->", "restUtils", "->", "serialize", "(", "$", "model", "->", "findAll", ...
Returns all records @param Request $request Current http request @return \Symfony\Component\HttpFoundation\Response $response Response with result or error
[ "Returns", "all", "records" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Controller/RestController.php#L189-L200
26,468
libgraviton/graviton
src/Graviton/RestBundle/Controller/RestController.php
RestController.postAction
public function postAction(Request $request) { // Get the response object from container $response = $this->getResponse(); $model = $this->getModel(); $this->restUtils->checkJsonRequest($request, $response, $this->getModel()); $record = $this->restUtils->validateRequest($re...
php
public function postAction(Request $request) { // Get the response object from container $response = $this->getResponse(); $model = $this->getModel(); $this->restUtils->checkJsonRequest($request, $response, $this->getModel()); $record = $this->restUtils->validateRequest($re...
[ "public", "function", "postAction", "(", "Request", "$", "request", ")", "{", "// Get the response object from container", "$", "response", "=", "$", "this", "->", "getResponse", "(", ")", ";", "$", "model", "=", "$", "this", "->", "getModel", "(", ")", ";",...
Writes a new Entry to the database @param Request $request Current http request @return \Symfony\Component\HttpFoundation\Response $response Result of action with data (if successful)
[ "Writes", "a", "new", "Entry", "to", "the", "database" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Controller/RestController.php#L209-L234
26,469
libgraviton/graviton
src/Graviton/RestBundle/Controller/RestController.php
RestController.patchAction
public function patchAction($id, Request $request) { $response = $this->getResponse(); $model = $this->getModel(); // Validate received data. On failure release the lock. try { // Check JSON Patch request $this->restUtils->checkJsonRequest($request, $response...
php
public function patchAction($id, Request $request) { $response = $this->getResponse(); $model = $this->getModel(); // Validate received data. On failure release the lock. try { // Check JSON Patch request $this->restUtils->checkJsonRequest($request, $response...
[ "public", "function", "patchAction", "(", "$", "id", ",", "Request", "$", "request", ")", "{", "$", "response", "=", "$", "this", "->", "getResponse", "(", ")", ";", "$", "model", "=", "$", "this", "->", "getModel", "(", ")", ";", "// Validate received...
Patch a record @param Number $id ID of record @param Request $request Current http request @throws MalformedInputException @return Response $response Result of action with data (if successful)
[ "Patch", "a", "record" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Controller/RestController.php#L301-L348
26,470
libgraviton/graviton
src/Graviton/RestBundle/Controller/RestController.php
RestController.schemaAction
public function schemaAction(Request $request, $id = null) { $request->attributes->set('schemaRequest', true); list($app, $module, , $modelName, $schemaType) = explode('.', $request->attributes->get('_route')); $response = $this->response; $response->setStatusCode(Response::HTTP_OK...
php
public function schemaAction(Request $request, $id = null) { $request->attributes->set('schemaRequest', true); list($app, $module, , $modelName, $schemaType) = explode('.', $request->attributes->get('_route')); $response = $this->response; $response->setStatusCode(Response::HTTP_OK...
[ "public", "function", "schemaAction", "(", "Request", "$", "request", ",", "$", "id", "=", "null", ")", "{", "$", "request", "->", "attributes", "->", "set", "(", "'schemaRequest'", ",", "true", ")", ";", "list", "(", "$", "app", ",", "$", "module", ...
Return schema GET results. @param Request $request Current http request @param string $id ID of record @throws SerializationException @return \Symfony\Component\HttpFoundation\Response $response Result of the action
[ "Return", "schema", "GET", "results", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Controller/RestController.php#L406-L438
26,471
libgraviton/graviton
src/Graviton/RestBundle/DependencyInjection/Compiler/RqlQueryRoutesCompilerPass.php
RqlQueryRoutesCompilerPass.process
public function process(ContainerBuilder $container) { $routes = []; foreach ($container->getParameter('graviton.rest.services') as $service => $params) { list($app, $bundle, , $entity) = explode('.', $service); $routes[] = implode('.', [$app, $bundle, 'rest', $entity, 'all']...
php
public function process(ContainerBuilder $container) { $routes = []; foreach ($container->getParameter('graviton.rest.services') as $service => $params) { list($app, $bundle, , $entity) = explode('.', $service); $routes[] = implode('.', [$app, $bundle, 'rest', $entity, 'all']...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "routes", "=", "[", "]", ";", "foreach", "(", "$", "container", "->", "getParameter", "(", "'graviton.rest.services'", ")", "as", "$", "service", "=>", "$", "params", ...
Find "allAction" routes and set it to allowed routes for RQL parsing @param ContainerBuilder $container Container builder @return void
[ "Find", "allAction", "routes", "and", "set", "it", "to", "allowed", "routes", "for", "RQL", "parsing" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/DependencyInjection/Compiler/RqlQueryRoutesCompilerPass.php#L24-L34
26,472
libgraviton/graviton
src/Graviton/AnalyticsBundle/Listener/HomepageRenderListener.php
HomepageRenderListener.onRender
public function onRender(HomepageRenderEvent $event) { $services = $this->serviceManager->getServices(); foreach ($services as $service) { $event->addRoute($service['$ref'], $service['profile']); } }
php
public function onRender(HomepageRenderEvent $event) { $services = $this->serviceManager->getServices(); foreach ($services as $service) { $event->addRoute($service['$ref'], $service['profile']); } }
[ "public", "function", "onRender", "(", "HomepageRenderEvent", "$", "event", ")", "{", "$", "services", "=", "$", "this", "->", "serviceManager", "->", "getServices", "(", ")", ";", "foreach", "(", "$", "services", "as", "$", "service", ")", "{", "$", "ev...
Add our links to the homepage @param HomepageRenderEvent $event event @return void
[ "Add", "our", "links", "to", "the", "homepage" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/AnalyticsBundle/Listener/HomepageRenderListener.php#L42-L48
26,473
libgraviton/graviton
src/Graviton/CoreBundle/Controller/FaviconController.php
FaviconController.iconAction
public function iconAction() { header('Content-Type: image/x-icon'); // open our file $fp = fopen(__DIR__.'/../Resources/assets/favicon.ico', 'r'); fpassthru($fp); fclose($fp); exit; }
php
public function iconAction() { header('Content-Type: image/x-icon'); // open our file $fp = fopen(__DIR__.'/../Resources/assets/favicon.ico', 'r'); fpassthru($fp); fclose($fp); exit; }
[ "public", "function", "iconAction", "(", ")", "{", "header", "(", "'Content-Type: image/x-icon'", ")", ";", "// open our file", "$", "fp", "=", "fopen", "(", "__DIR__", ".", "'/../Resources/assets/favicon.ico'", ",", "'r'", ")", ";", "fpassthru", "(", "$", "fp",...
renders a favicon @return \Symfony\Component\HttpFoundation\Response $response Response with result or error
[ "renders", "a", "favicon" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/CoreBundle/Controller/FaviconController.php#L21-L29
26,474
libgraviton/graviton
src/Graviton/RestBundle/Listener/XVersionResponseListener.php
XVersionResponseListener.onKernelResponse
public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { // don't do anything if it's not the master request return; } $event->getResponse()->headers->set( 'X-Version', $this->versionHeader ); ...
php
public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { // don't do anything if it's not the master request return; } $event->getResponse()->headers->set( 'X-Version', $this->versionHeader ); ...
[ "public", "function", "onKernelResponse", "(", "FilterResponseEvent", "$", "event", ")", "{", "if", "(", "!", "$", "event", "->", "isMasterRequest", "(", ")", ")", "{", "// don't do anything if it's not the master request", "return", ";", "}", "$", "event", "->", ...
Adds a X-Version header to the response. @param FilterResponseEvent $event Current emitted event. @return void
[ "Adds", "a", "X", "-", "Version", "header", "to", "the", "response", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RestBundle/Listener/XVersionResponseListener.php#L40-L51
26,475
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/ArrayField.php
ArrayField.getItemType
public function getItemType() { if (!preg_match('/array\<(.+)\>/i', $this->serializerType, $matches)) { return $this->serializerType; } $map = [ 'DateTime' => 'date', 'integer' => 'int', 'float' => 'float', 'double' => 'f...
php
public function getItemType() { if (!preg_match('/array\<(.+)\>/i', $this->serializerType, $matches)) { return $this->serializerType; } $map = [ 'DateTime' => 'date', 'integer' => 'int', 'float' => 'float', 'double' => 'f...
[ "public", "function", "getItemType", "(", ")", "{", "if", "(", "!", "preg_match", "(", "'/array\\<(.+)\\>/i'", ",", "$", "this", "->", "serializerType", ",", "$", "matches", ")", ")", "{", "return", "$", "this", "->", "serializerType", ";", "}", "$", "ma...
Get item type @return string
[ "Get", "item", "type" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/Utils/ArrayField.php#L59-L74
26,476
libgraviton/graviton
src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php
VersionServiceConstraint.isVersioningService
public function isVersioningService() { $schema = $this->utils->getCurrentSchema(); if (isset($schema->{'x-versioning'}) && $schema->{'x-versioning'} === true) { return true; } return false; }
php
public function isVersioningService() { $schema = $this->utils->getCurrentSchema(); if (isset($schema->{'x-versioning'}) && $schema->{'x-versioning'} === true) { return true; } return false; }
[ "public", "function", "isVersioningService", "(", ")", "{", "$", "schema", "=", "$", "this", "->", "utils", "->", "getCurrentSchema", "(", ")", ";", "if", "(", "isset", "(", "$", "schema", "->", "{", "'x-versioning'", "}", ")", "&&", "$", "schema", "->...
tells whether the current service has versioning activated or not @return bool true if yes, false otherwise
[ "tells", "whether", "the", "current", "service", "has", "versioning", "activated", "or", "not" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php#L85-L92
26,477
libgraviton/graviton
src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php
VersionServiceConstraint.getVersionFromObject
private function getVersionFromObject($object) { $version = null; if ($this->accessor->isReadable($object, self::FIELD_NAME)) { $version = $this->accessor->getValue($object, self::FIELD_NAME); } return $version; }
php
private function getVersionFromObject($object) { $version = null; if ($this->accessor->isReadable($object, self::FIELD_NAME)) { $version = $this->accessor->getValue($object, self::FIELD_NAME); } return $version; }
[ "private", "function", "getVersionFromObject", "(", "$", "object", ")", "{", "$", "version", "=", "null", ";", "if", "(", "$", "this", "->", "accessor", "->", "isReadable", "(", "$", "object", ",", "self", "::", "FIELD_NAME", ")", ")", "{", "$", "versi...
returns the version from a given object @param object $object object @return int|null null or the specified version
[ "returns", "the", "version", "from", "a", "given", "object" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php#L101-L109
26,478
libgraviton/graviton
src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php
VersionServiceConstraint.getUserVersion
private function getUserVersion($object) { if ($this->utils->getCurrentRequestMethod() == 'PATCH') { $content = json_decode($this->utils->getCurrentRequestContent(), true); $hasVersion = array_filter( $content, function ($val) { if...
php
private function getUserVersion($object) { if ($this->utils->getCurrentRequestMethod() == 'PATCH') { $content = json_decode($this->utils->getCurrentRequestContent(), true); $hasVersion = array_filter( $content, function ($val) { if...
[ "private", "function", "getUserVersion", "(", "$", "object", ")", "{", "if", "(", "$", "this", "->", "utils", "->", "getCurrentRequestMethod", "(", ")", "==", "'PATCH'", ")", "{", "$", "content", "=", "json_decode", "(", "$", "this", "->", "utils", "->",...
Gets the user provided version, handling different scenarios @param object $object object @return int|null null or the specified version
[ "Gets", "the", "user", "provided", "version", "handling", "different", "scenarios" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php#L118-L139
26,479
libgraviton/graviton
src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php
VersionServiceConstraint.setCurrentVersionHeader
public function setCurrentVersionHeader(FilterResponseEvent $event) { if ($this->version) { $event->getResponse()->headers->set(self::HEADER_NAME, $this->version); } }
php
public function setCurrentVersionHeader(FilterResponseEvent $event) { if ($this->version) { $event->getResponse()->headers->set(self::HEADER_NAME, $this->version); } }
[ "public", "function", "setCurrentVersionHeader", "(", "FilterResponseEvent", "$", "event", ")", "{", "if", "(", "$", "this", "->", "version", ")", "{", "$", "event", "->", "getResponse", "(", ")", "->", "headers", "->", "set", "(", "self", "::", "HEADER_NA...
Setting if needed the headers to let user know what was the new version. @param FilterResponseEvent $event SF response event @return void
[ "Setting", "if", "needed", "the", "headers", "to", "let", "user", "know", "what", "was", "the", "new", "version", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php#L147-L152
26,480
libgraviton/graviton
src/Graviton/SchemaBundle/Constraint/ConstraintBuilder.php
ConstraintBuilder.addConstraints
public function addConstraints($fieldName, Schema $property, DocumentModel $model) { $constraints = $model->getConstraints($fieldName); if (!is_array($constraints)) { return $property; } foreach ($constraints as $constraint) { $isSupported = false; ...
php
public function addConstraints($fieldName, Schema $property, DocumentModel $model) { $constraints = $model->getConstraints($fieldName); if (!is_array($constraints)) { return $property; } foreach ($constraints as $constraint) { $isSupported = false; ...
[ "public", "function", "addConstraints", "(", "$", "fieldName", ",", "Schema", "$", "property", ",", "DocumentModel", "$", "model", ")", "{", "$", "constraints", "=", "$", "model", "->", "getConstraints", "(", "$", "fieldName", ")", ";", "if", "(", "!", "...
Go through the constraints and call the builders to do their job @param string $fieldName field name @param Schema $property the property @param DocumentModel $model the parent model @return Schema
[ "Go", "through", "the", "constraints", "and", "call", "the", "builders", "to", "do", "their", "job" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SchemaBundle/Constraint/ConstraintBuilder.php#L45-L72
26,481
konduto/php-sdk
src/Models/Payment.php
Payment.build
public static function build(array $array) { if (array_key_exists("type", $array) && in_array($array["type"], self::$availableTypes)) { switch ($array["type"]) { case Payment::TYPE_CREDIT: return new CreditCard($array); break; ...
php
public static function build(array $array) { if (array_key_exists("type", $array) && in_array($array["type"], self::$availableTypes)) { switch ($array["type"]) { case Payment::TYPE_CREDIT: return new CreditCard($array); break; ...
[ "public", "static", "function", "build", "(", "array", "$", "array", ")", "{", "if", "(", "array_key_exists", "(", "\"type\"", ",", "$", "array", ")", "&&", "in_array", "(", "$", "array", "[", "\"type\"", "]", ",", "self", "::", "$", "availableTypes", ...
Given an array, instantiates a payment among the possible types of payments. The decision of what Model to use is made by field 'type' @param $array: array containing fields of the Payment @return Payment CreditCard or Boleto object
[ "Given", "an", "array", "instantiates", "a", "payment", "among", "the", "possible", "types", "of", "payments", ".", "The", "decision", "of", "what", "Model", "to", "use", "is", "made", "by", "field", "type" ]
ff095590c30307897c557f980845f613ff351585
https://github.com/konduto/php-sdk/blob/ff095590c30307897c557f980845f613ff351585/src/Models/Payment.php#L32-L53
26,482
libgraviton/graviton
src/Graviton/RabbitMqBundle/Service/DumpConsumer.php
DumpConsumer.execute
public function execute(AMQPMessage $msg) { echo str_repeat('-', 60).PHP_EOL; echo '[RECV ' . date('c') . ']' . PHP_EOL .'<content>' . PHP_EOL . $msg->body . PHP_EOL . '</content>'.PHP_EOL.PHP_EOL; echo "*" . ' INFO ' . PHP_EOL; foreach ($msg->{'delivery_info'} as $key ...
php
public function execute(AMQPMessage $msg) { echo str_repeat('-', 60).PHP_EOL; echo '[RECV ' . date('c') . ']' . PHP_EOL .'<content>' . PHP_EOL . $msg->body . PHP_EOL . '</content>'.PHP_EOL.PHP_EOL; echo "*" . ' INFO ' . PHP_EOL; foreach ($msg->{'delivery_info'} as $key ...
[ "public", "function", "execute", "(", "AMQPMessage", "$", "msg", ")", "{", "echo", "str_repeat", "(", "'-'", ",", "60", ")", ".", "PHP_EOL", ";", "echo", "'[RECV '", ".", "date", "(", "'c'", ")", ".", "']'", ".", "PHP_EOL", ".", "'<content>'", ".", "...
Callback executed when a message is received. Dumps the message body, delivery_info and properties. @param AMQPMessage $msg The received message. @return void
[ "Callback", "executed", "when", "a", "message", "is", "received", ".", "Dumps", "the", "message", "body", "delivery_info", "and", "properties", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/RabbitMqBundle/Service/DumpConsumer.php#L29-L48
26,483
konduto/php-sdk
src/Models/Travel.php
Travel.build
public static function build(array $args) { if (is_array($args) && array_key_exists("type", $args)) { switch ($args["type"]) { case Travel::TYPE_BUS: return new BusTravel($args); case Travel::TYPE_FLIGHT: return new Flight($args...
php
public static function build(array $args) { if (is_array($args) && array_key_exists("type", $args)) { switch ($args["type"]) { case Travel::TYPE_BUS: return new BusTravel($args); case Travel::TYPE_FLIGHT: return new Flight($args...
[ "public", "static", "function", "build", "(", "array", "$", "args", ")", "{", "if", "(", "is_array", "(", "$", "args", ")", "&&", "array_key_exists", "(", "\"type\"", ",", "$", "args", ")", ")", "{", "switch", "(", "$", "args", "[", "\"type\"", "]", ...
Given an array, instantiates a travel among the possible types of travel. The decision of what Model to use is made by the field 'type' @param array $args: array containing fields of the Travel @return Travel BusTravel or Flight object
[ "Given", "an", "array", "instantiates", "a", "travel", "among", "the", "possible", "types", "of", "travel", ".", "The", "decision", "of", "what", "Model", "to", "use", "is", "made", "by", "the", "field", "type" ]
ff095590c30307897c557f980845f613ff351585
https://github.com/konduto/php-sdk/blob/ff095590c30307897c557f980845f613ff351585/src/Models/Travel.php#L35-L45
26,484
libgraviton/graviton
src/Graviton/SecurityBundle/Controller/WhoAmIController.php
WhoAmIController.whoAmIAction
public function whoAmIAction() { /** @var SecurityUser $securityUser */ $securityUser = $this->getSecurityUser(); /** @var Response $response */ $response = $this->getResponse(); $response->headers->set('Content-Type', 'application/json'); if (!$securityUser) { ...
php
public function whoAmIAction() { /** @var SecurityUser $securityUser */ $securityUser = $this->getSecurityUser(); /** @var Response $response */ $response = $this->getResponse(); $response->headers->set('Content-Type', 'application/json'); if (!$securityUser) { ...
[ "public", "function", "whoAmIAction", "(", ")", "{", "/** @var SecurityUser $securityUser */", "$", "securityUser", "=", "$", "this", "->", "getSecurityUser", "(", ")", ";", "/** @var Response $response */", "$", "response", "=", "$", "this", "->", "getResponse", "(...
Currently authenticated user information. If security is not enabled then header will be Not Allowed. If User not found using correct header Anonymous user Serialised Object transformer @return Response $response Response with result or error
[ "Currently", "authenticated", "user", "information", ".", "If", "security", "is", "not", "enabled", "then", "header", "will", "be", "Not", "Allowed", ".", "If", "User", "not", "found", "using", "correct", "header", "Anonymous", "user", "Serialised", "Object", ...
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/SecurityBundle/Controller/WhoAmIController.php#L28-L47
26,485
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.getExistingBundleHashes
private function getExistingBundleHashes($baseDir) { $existingBundles = []; $fs = new Filesystem(); $bundleBaseDir = $baseDir.self::BUNDLE_NAMESPACE; if (!$fs->exists($bundleBaseDir)) { return $existingBundles; } $bundleFinder = $this->getBundleFinder($b...
php
private function getExistingBundleHashes($baseDir) { $existingBundles = []; $fs = new Filesystem(); $bundleBaseDir = $baseDir.self::BUNDLE_NAMESPACE; if (!$fs->exists($bundleBaseDir)) { return $existingBundles; } $bundleFinder = $this->getBundleFinder($b...
[ "private", "function", "getExistingBundleHashes", "(", "$", "baseDir", ")", "{", "$", "existingBundles", "=", "[", "]", ";", "$", "fs", "=", "new", "Filesystem", "(", ")", ";", "$", "bundleBaseDir", "=", "$", "baseDir", ".", "self", "::", "BUNDLE_NAMESPACE...
scans through all existing dynamic bundles, checks if there is a generation hash and collect that all in an array that can be used for fast checking. @param string $baseDir base directory of dynamic bundles @return array key is bundlepath, value is the current hash
[ "scans", "through", "all", "existing", "dynamic", "bundles", "checks", "if", "there", "is", "a", "generation", "hash", "and", "collect", "that", "all", "in", "an", "array", "that", "can", "be", "used", "for", "fast", "checking", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L290-L323
26,486
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.getBundleClassnameFromFolder
private function getBundleClassnameFromFolder($folderName) { if (substr($folderName, -6) == 'Bundle') { $folderName = substr($folderName, 0, -6); } return sprintf(self::BUNDLE_NAME_MASK, $folderName); }
php
private function getBundleClassnameFromFolder($folderName) { if (substr($folderName, -6) == 'Bundle') { $folderName = substr($folderName, 0, -6); } return sprintf(self::BUNDLE_NAME_MASK, $folderName); }
[ "private", "function", "getBundleClassnameFromFolder", "(", "$", "folderName", ")", "{", "if", "(", "substr", "(", "$", "folderName", ",", "-", "6", ")", "==", "'Bundle'", ")", "{", "$", "folderName", "=", "substr", "(", "$", "folderName", ",", "0", ",",...
from a name of a folder of a bundle, this function returns the corresponding class name @param string $folderName folder name @return string
[ "from", "a", "name", "of", "a", "folder", "of", "a", "bundle", "this", "function", "returns", "the", "corresponding", "class", "name" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L332-L339
26,487
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.getBundleFinder
private function getBundleFinder($baseDir) { $bundleBaseDir = $baseDir.self::BUNDLE_NAMESPACE; if (!(new Filesystem())->exists($bundleBaseDir)) { return null; } $bundleFinder = new Finder(); $bundleFinder->directories()->in($bundleBaseDir)->depth('== 0')->notNam...
php
private function getBundleFinder($baseDir) { $bundleBaseDir = $baseDir.self::BUNDLE_NAMESPACE; if (!(new Filesystem())->exists($bundleBaseDir)) { return null; } $bundleFinder = new Finder(); $bundleFinder->directories()->in($bundleBaseDir)->depth('== 0')->notNam...
[ "private", "function", "getBundleFinder", "(", "$", "baseDir", ")", "{", "$", "bundleBaseDir", "=", "$", "baseDir", ".", "self", "::", "BUNDLE_NAMESPACE", ";", "if", "(", "!", "(", "new", "Filesystem", "(", ")", ")", "->", "exists", "(", "$", "bundleBase...
returns a finder that iterates all bundle directories @param string $baseDir the base dir to search @return Finder|null finder or null if basedir does not exist
[ "returns", "a", "finder", "that", "iterates", "all", "bundle", "directories" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L348-L360
26,488
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.getTemplateHash
private function getTemplateHash() { $templateDir = __DIR__ . '/../Resources/skeleton'; $resourceFinder = new Finder(); $resourceFinder->in($templateDir)->files()->sortByName(); $templateTimes = ''; foreach ($resourceFinder as $file) { $templateTimes .= PATH_SEPAR...
php
private function getTemplateHash() { $templateDir = __DIR__ . '/../Resources/skeleton'; $resourceFinder = new Finder(); $resourceFinder->in($templateDir)->files()->sortByName(); $templateTimes = ''; foreach ($resourceFinder as $file) { $templateTimes .= PATH_SEPAR...
[ "private", "function", "getTemplateHash", "(", ")", "{", "$", "templateDir", "=", "__DIR__", ".", "'/../Resources/skeleton'", ";", "$", "resourceFinder", "=", "new", "Finder", "(", ")", ";", "$", "resourceFinder", "->", "in", "(", "$", "templateDir", ")", "-...
Calculates a hash of all templates that generator uses to output it's file. That way a regeneration will be triggered when one of them changes.. @return string hash
[ "Calculates", "a", "hash", "of", "all", "templates", "that", "generator", "uses", "to", "output", "it", "s", "file", ".", "That", "way", "a", "regeneration", "will", "be", "triggered", "when", "one", "of", "them", "changes", ".." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L368-L378
26,489
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.generateSubResources
protected function generateSubResources( OutputInterface $output, JsonDefinition $jsonDef, $bundleName, $bundleClassName ) { foreach ($this->getSubResources($jsonDef) as $subRecource) { $arguments = [ 'graviton:generate:resource', '...
php
protected function generateSubResources( OutputInterface $output, JsonDefinition $jsonDef, $bundleName, $bundleClassName ) { foreach ($this->getSubResources($jsonDef) as $subRecource) { $arguments = [ 'graviton:generate:resource', '...
[ "protected", "function", "generateSubResources", "(", "OutputInterface", "$", "output", ",", "JsonDefinition", "$", "jsonDef", ",", "$", "bundleName", ",", "$", "bundleClassName", ")", "{", "foreach", "(", "$", "this", "->", "getSubResources", "(", "$", "jsonDef...
Generate Bundle entities @param OutputInterface $output Instance to sent text to be displayed on stout. @param JsonDefinition $jsonDef Configuration to be generated the entity from. @param string $bundleName Name of the bundle the entity shall be generated for. @param string $b...
[ "Generate", "Bundle", "entities" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L391-L408
26,490
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.generateResources
protected function generateResources( JsonDefinition $jsonDef, $bundleName, $bundleDir, $bundleNamespace ) { /** @var ResourceGenerator $generator */ $generator = $this->resourceGenerator; $generator->setGenerateController(false); foreach ($this->get...
php
protected function generateResources( JsonDefinition $jsonDef, $bundleName, $bundleDir, $bundleNamespace ) { /** @var ResourceGenerator $generator */ $generator = $this->resourceGenerator; $generator->setGenerateController(false); foreach ($this->get...
[ "protected", "function", "generateResources", "(", "JsonDefinition", "$", "jsonDef", ",", "$", "bundleName", ",", "$", "bundleDir", ",", "$", "bundleNamespace", ")", "{", "/** @var ResourceGenerator $generator */", "$", "generator", "=", "$", "this", "->", "resource...
generates the resources of a bundle @param JsonDefinition $jsonDef definition @param string $bundleName name @param string $bundleDir dir @param string $bundleNamespace namespace @return void
[ "generates", "the", "resources", "of", "a", "bundle" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L420-L458
26,491
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.getSubResources
protected function getSubResources(JsonDefinition $definition) { $resources = []; foreach ($definition->getFields() as $field) { while ($field instanceof JsonDefinitionArray) { $field = $field->getElement(); } if (!$field instanceof JsonDefinitionH...
php
protected function getSubResources(JsonDefinition $definition) { $resources = []; foreach ($definition->getFields() as $field) { while ($field instanceof JsonDefinitionArray) { $field = $field->getElement(); } if (!$field instanceof JsonDefinitionH...
[ "protected", "function", "getSubResources", "(", "JsonDefinition", "$", "definition", ")", "{", "$", "resources", "=", "[", "]", ";", "foreach", "(", "$", "definition", "->", "getFields", "(", ")", "as", "$", "field", ")", "{", "while", "(", "$", "field"...
Get all sub hashes @param JsonDefinition $definition Main JSON definition @return JsonDefinition[]
[ "Get", "all", "sub", "hashes" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L466-L484
26,492
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.generateResource
private function generateResource(array $arguments, OutputInterface $output, JsonDefinition $jsonDef) { // controller? $routerBase = $jsonDef->getRouterBase(); if ($routerBase === false || $this->isNotWhitelistedController($routerBase)) { $arguments['--no-controller'] = 'true'; ...
php
private function generateResource(array $arguments, OutputInterface $output, JsonDefinition $jsonDef) { // controller? $routerBase = $jsonDef->getRouterBase(); if ($routerBase === false || $this->isNotWhitelistedController($routerBase)) { $arguments['--no-controller'] = 'true'; ...
[ "private", "function", "generateResource", "(", "array", "$", "arguments", ",", "OutputInterface", "$", "output", ",", "JsonDefinition", "$", "jsonDef", ")", "{", "// controller?", "$", "routerBase", "=", "$", "jsonDef", "->", "getRouterBase", "(", ")", ";", "...
Gathers data for the command to run. @param array $arguments Set of cli arguments passed to the command @param OutputInterface $output Output channel to send messages to. @param JsonDefinition $jsonDef Configuration of the service @return void @throws \LogicException
[ "Gathers", "data", "for", "the", "command", "to", "run", "." ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L496-L505
26,493
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.generateBundleBundleClass
private function generateBundleBundleClass() { // add optional bundles if defined by parameter. if ($this->bundleAdditions !== null) { $this->bundleBundleGenerator->setAdditions($this->bundleAdditions); } else { $this->bundleBundleGenerator->setAdditions([]); ...
php
private function generateBundleBundleClass() { // add optional bundles if defined by parameter. if ($this->bundleAdditions !== null) { $this->bundleBundleGenerator->setAdditions($this->bundleAdditions); } else { $this->bundleBundleGenerator->setAdditions([]); ...
[ "private", "function", "generateBundleBundleClass", "(", ")", "{", "// add optional bundles if defined by parameter.", "if", "(", "$", "this", "->", "bundleAdditions", "!==", "null", ")", "{", "$", "this", "->", "bundleBundleGenerator", "->", "setAdditions", "(", "$",...
Generates our BundleBundle for dynamic bundles. It basically replaces the Bundle main class that got generated by the Sensio bundle task and it includes all of our bundles there. @return void
[ "Generates", "our", "BundleBundle", "for", "dynamic", "bundles", ".", "It", "basically", "replaces", "the", "Bundle", "main", "class", "that", "got", "generated", "by", "the", "Sensio", "bundle", "task", "and", "it", "includes", "all", "of", "our", "bundles", ...
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L538-L553
26,494
libgraviton/graviton
src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
GenerateDynamicBundleCommand.generateGenerationHashFile
private function generateGenerationHashFile($bundleDir, $hash) { $fs = new Filesystem(); if ($fs->exists($bundleDir)) { $fs->dumpFile($bundleDir.DIRECTORY_SEPARATOR.self::GENERATION_HASHFILE_FILENAME, $hash); } }
php
private function generateGenerationHashFile($bundleDir, $hash) { $fs = new Filesystem(); if ($fs->exists($bundleDir)) { $fs->dumpFile($bundleDir.DIRECTORY_SEPARATOR.self::GENERATION_HASHFILE_FILENAME, $hash); } }
[ "private", "function", "generateGenerationHashFile", "(", "$", "bundleDir", ",", "$", "hash", ")", "{", "$", "fs", "=", "new", "Filesystem", "(", ")", ";", "if", "(", "$", "fs", "->", "exists", "(", "$", "bundleDir", ")", ")", "{", "$", "fs", "->", ...
Generates the file containing the hash to determine if this bundle needs regeneration @param string $bundleDir directory of the bundle @param string $hash the hash to save @return void
[ "Generates", "the", "file", "containing", "the", "hash", "to", "determine", "if", "this", "bundle", "needs", "regeneration" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php#L582-L588
26,495
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/ExtRefFieldsCompilerPass.php
ExtRefFieldsCompilerPass.process
public function process(ContainerBuilder $container) { $this->documentMap = $container->get('graviton.document.map'); $map = []; $services = array_keys($container->findTaggedServiceIds('graviton.rest')); foreach ($services as $id) { list($ns, $bundle, , $doc) = explode(...
php
public function process(ContainerBuilder $container) { $this->documentMap = $container->get('graviton.document.map'); $map = []; $services = array_keys($container->findTaggedServiceIds('graviton.rest')); foreach ($services as $id) { list($ns, $bundle, , $doc) = explode(...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "this", "->", "documentMap", "=", "$", "container", "->", "get", "(", "'graviton.document.map'", ")", ";", "$", "map", "=", "[", "]", ";", "$", "services", "=", "a...
Make extref fields map and set it to parameter @param ContainerBuilder $container container builder @return void
[ "Make", "extref", "fields", "map", "and", "set", "it", "to", "parameter" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/ExtRefFieldsCompilerPass.php#L41-L71
26,496
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/ExtRefFieldsCompilerPass.php
ExtRefFieldsCompilerPass.getServiceDocument
private function getServiceDocument(Definition $service, $ns, $bundle, $doc) { $tags = $service->getTag('graviton.rest'); if (!empty($tags[0]['collection'])) { $doc = $tags[0]['collection']; $bundle = $tags[0]['collection']; } if (strtolower($ns) === 'gravito...
php
private function getServiceDocument(Definition $service, $ns, $bundle, $doc) { $tags = $service->getTag('graviton.rest'); if (!empty($tags[0]['collection'])) { $doc = $tags[0]['collection']; $bundle = $tags[0]['collection']; } if (strtolower($ns) === 'gravito...
[ "private", "function", "getServiceDocument", "(", "Definition", "$", "service", ",", "$", "ns", ",", "$", "bundle", ",", "$", "doc", ")", "{", "$", "tags", "=", "$", "service", "->", "getTag", "(", "'graviton.rest'", ")", ";", "if", "(", "!", "empty", ...
Get document class name from service @param Definition $service Service definition @param string $ns Bundle namespace @param string $bundle Bundle name @param string $doc Document name @return string
[ "Get", "document", "class", "name", "from", "service" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/ExtRefFieldsCompilerPass.php#L83-L101
26,497
libgraviton/graviton
src/Graviton/DocumentBundle/DependencyInjection/Compiler/ExtRefFieldsCompilerPass.php
ExtRefFieldsCompilerPass.processDocument
private function processDocument(Document $document, $exposedPrefix = '') { $result = []; foreach ($document->getFields() as $field) { if ($field instanceof Field) { if ($field->getType() === 'extref') { $result[] = $exposedPrefix.$field->getExposedNam...
php
private function processDocument(Document $document, $exposedPrefix = '') { $result = []; foreach ($document->getFields() as $field) { if ($field instanceof Field) { if ($field->getType() === 'extref') { $result[] = $exposedPrefix.$field->getExposedNam...
[ "private", "function", "processDocument", "(", "Document", "$", "document", ",", "$", "exposedPrefix", "=", "''", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "document", "->", "getFields", "(", ")", "as", "$", "field", ")", "{", ...
Recursive doctrine document processing @param Document $document Document @param string $exposedPrefix Exposed field prefix @return array
[ "Recursive", "doctrine", "document", "processing" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/DocumentBundle/DependencyInjection/Compiler/ExtRefFieldsCompilerPass.php#L110-L142
26,498
libgraviton/graviton
src/Graviton/ProxyBundle/Definition/Loader/HttpLoader.php
HttpLoader.supports
public function supports($url) { $error = $this->validator->validate($url, [new Url()]); return 0 === count($error); }
php
public function supports($url) { $error = $this->validator->validate($url, [new Url()]); return 0 === count($error); }
[ "public", "function", "supports", "(", "$", "url", ")", "{", "$", "error", "=", "$", "this", "->", "validator", "->", "validate", "(", "$", "url", ",", "[", "new", "Url", "(", ")", "]", ")", ";", "return", "0", "===", "count", "(", "$", "error", ...
check if the url is valid @param string $url url @return boolean
[ "check", "if", "the", "url", "is", "valid" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Definition/Loader/HttpLoader.php#L136-L141
26,499
libgraviton/graviton
src/Graviton/ProxyBundle/Definition/Loader/HttpLoader.php
HttpLoader.fetchFile
private function fetchFile(RequestInterface $request) { $content = "{}"; try { $response = $this->client->send($request); $content = (string) $response->getBody(); if (isset($this->cache)) { $this->cache->save($this->options['storeKey'], $content, ...
php
private function fetchFile(RequestInterface $request) { $content = "{}"; try { $response = $this->client->send($request); $content = (string) $response->getBody(); if (isset($this->cache)) { $this->cache->save($this->options['storeKey'], $content, ...
[ "private", "function", "fetchFile", "(", "RequestInterface", "$", "request", ")", "{", "$", "content", "=", "\"{}\"", ";", "try", "{", "$", "response", "=", "$", "this", "->", "client", "->", "send", "(", "$", "request", ")", ";", "$", "content", "=", ...
fetch file from remote destination @param RequestInterface $request request @return string
[ "fetch", "file", "from", "remote", "destination" ]
5eccfb2fba31dadf659f0f55edeb1ebca403563e
https://github.com/libgraviton/graviton/blob/5eccfb2fba31dadf659f0f55edeb1ebca403563e/src/Graviton/ProxyBundle/Definition/Loader/HttpLoader.php#L196-L217