repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
FriendsOfSymfony/FOSRestBundle
Serializer/JMSHandlerRegistry.php
JMSHandlerRegistry.getHandler
public function getHandler($direction, $typeName, $format) { do { $handler = $this->registry->getHandler($direction, $typeName, $format); if (null !== $handler) { return $handler; } } while ($typeName = get_parent_class($typeName)); }
php
public function getHandler($direction, $typeName, $format) { do { $handler = $this->registry->getHandler($direction, $typeName, $format); if (null !== $handler) { return $handler; } } while ($typeName = get_parent_class($typeName)); }
[ "public", "function", "getHandler", "(", "$", "direction", ",", "$", "typeName", ",", "$", "format", ")", "{", "do", "{", "$", "handler", "=", "$", "this", "->", "registry", "->", "getHandler", "(", "$", "direction", ",", "$", "typeName", ",", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/JMSHandlerRegistry.php#L52-L60
FriendsOfSymfony/FOSRestBundle
EventListener/MimeTypeListener.php
MimeTypeListener.onKernelRequest
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { foreach ($thi...
php
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { foreach ($thi...
[ "public", "function", "onKernelRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "request", "->", "attributes", "->", "get", "(", "FOSRestBundle", "::", "...
Core request handler. @param GetResponseEvent $event The event
[ "Core", "request", "handler", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/MimeTypeListener.php#L46-L69
FriendsOfSymfony/FOSRestBundle
Controller/ExceptionController.php
ExceptionController.showAction
public function showAction(Request $request, $exception, DebugLoggerInterface $logger = null) { $currentContent = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1)); $code = $this->getStatusCode($exception); $templateData = $this->getTemplateData($currentContent,...
php
public function showAction(Request $request, $exception, DebugLoggerInterface $logger = null) { $currentContent = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1)); $code = $this->getStatusCode($exception); $templateData = $this->getTemplateData($currentContent,...
[ "public", "function", "showAction", "(", "Request", "$", "request", ",", "$", "exception", ",", "DebugLoggerInterface", "$", "logger", "=", "null", ")", "{", "$", "currentContent", "=", "$", "this", "->", "getAndCleanOutputBuffering", "(", "$", "request", "->"...
Converts an Exception to a Response. @param Request $request @param \Exception|\Throwable $exception @param DebugLoggerInterface|null $logger @throws \InvalidArgumentException @return Response
[ "Converts", "an", "Exception", "to", "a", "Response", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/ExceptionController.php#L64-L74
FriendsOfSymfony/FOSRestBundle
Controller/ExceptionController.php
ExceptionController.createView
protected function createView(\Exception $exception, $code, array $templateData, Request $request, $showException) { $view = new View($exception, $code, $exception instanceof HttpExceptionInterface ? $exception->getHeaders() : []); $view->setTemplateVar('raw_exception'); $view->setTemplateDa...
php
protected function createView(\Exception $exception, $code, array $templateData, Request $request, $showException) { $view = new View($exception, $code, $exception instanceof HttpExceptionInterface ? $exception->getHeaders() : []); $view->setTemplateVar('raw_exception'); $view->setTemplateDa...
[ "protected", "function", "createView", "(", "\\", "Exception", "$", "exception", ",", "$", "code", ",", "array", "$", "templateData", ",", "Request", "$", "request", ",", "$", "showException", ")", "{", "$", "view", "=", "new", "View", "(", "$", "excepti...
@param \Exception $exception @param int $code @param array $templateData @param Request $request @param bool $showException @return View
[ "@param", "\\", "Exception", "$exception", "@param", "int", "$code", "@param", "array", "$templateData", "@param", "Request", "$request", "@param", "bool", "$showException" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/ExceptionController.php#L85-L92
FriendsOfSymfony/FOSRestBundle
Controller/ExceptionController.php
ExceptionController.getStatusCode
protected function getStatusCode(\Exception $exception) { // If matched if ($statusCode = $this->exceptionCodes->resolveException($exception)) { return $statusCode; } // Otherwise, default if ($exception instanceof HttpExceptionInterface) { return $ex...
php
protected function getStatusCode(\Exception $exception) { // If matched if ($statusCode = $this->exceptionCodes->resolveException($exception)) { return $statusCode; } // Otherwise, default if ($exception instanceof HttpExceptionInterface) { return $ex...
[ "protected", "function", "getStatusCode", "(", "\\", "Exception", "$", "exception", ")", "{", "// If matched", "if", "(", "$", "statusCode", "=", "$", "this", "->", "exceptionCodes", "->", "resolveException", "(", "$", "exception", ")", ")", "{", "return", "...
Determines the status code to use for the response. @param \Exception $exception @return int
[ "Determines", "the", "status", "code", "to", "use", "for", "the", "response", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/ExceptionController.php#L101-L114
FriendsOfSymfony/FOSRestBundle
Controller/ExceptionController.php
ExceptionController.getTemplateData
private function getTemplateData($currentContent, $code, \Exception $exception, DebugLoggerInterface $logger = null) { return [ 'exception' => FlattenException::create($exception), 'status' => 'error', 'status_code' => $code, 'status_text' => array_key_exists(...
php
private function getTemplateData($currentContent, $code, \Exception $exception, DebugLoggerInterface $logger = null) { return [ 'exception' => FlattenException::create($exception), 'status' => 'error', 'status_code' => $code, 'status_text' => array_key_exists(...
[ "private", "function", "getTemplateData", "(", "$", "currentContent", ",", "$", "code", ",", "\\", "Exception", "$", "exception", ",", "DebugLoggerInterface", "$", "logger", "=", "null", ")", "{", "return", "[", "'exception'", "=>", "FlattenException", "::", "...
Determines the template parameters to pass to the view layer. @param string $currentContent @param int $code @param \Exception $exception @param DebugLoggerInterface $logger @return array
[ "Determines", "the", "template", "parameters", "to", "pass", "to", "the", "view", "layer", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/ExceptionController.php#L126-L136
FriendsOfSymfony/FOSRestBundle
EventListener/ParamFetcherListener.php
ParamFetcherListener.onKernelController
public function onKernelController(FilterControllerEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } $controller = $event->getController(); if (is_callable($controller) && method_ex...
php
public function onKernelController(FilterControllerEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } $controller = $event->getController(); if (is_callable($controller) && method_ex...
[ "public", "function", "onKernelController", "(", "FilterControllerEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "request", "->", "attributes", "->", "get", "(", "FOSRestBundle", "...
Core controller handler. @param FilterControllerEvent $event @throws \InvalidArgumentException
[ "Core", "controller", "handler", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/ParamFetcherListener.php#L52-L82
FriendsOfSymfony/FOSRestBundle
EventListener/ParamFetcherListener.php
ParamFetcherListener.getAttributeName
private function getAttributeName(callable $controller) { list($object, $name) = $controller; $method = new \ReflectionMethod($object, $name); foreach ($method->getParameters() as $param) { if ($this->isParamFetcherType($param)) { return $param->getName(); ...
php
private function getAttributeName(callable $controller) { list($object, $name) = $controller; $method = new \ReflectionMethod($object, $name); foreach ($method->getParameters() as $param) { if ($this->isParamFetcherType($param)) { return $param->getName(); ...
[ "private", "function", "getAttributeName", "(", "callable", "$", "controller", ")", "{", "list", "(", "$", "object", ",", "$", "name", ")", "=", "$", "controller", ";", "$", "method", "=", "new", "\\", "ReflectionMethod", "(", "$", "object", ",", "$", ...
Determines which attribute the ParamFetcher should be injected as. @param callable $controller The controller action as an "array" callable @return string
[ "Determines", "which", "attribute", "the", "ParamFetcher", "should", "be", "injected", "as", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/ParamFetcherListener.php#L91-L103
FriendsOfSymfony/FOSRestBundle
EventListener/ParamFetcherListener.php
ParamFetcherListener.isParamFetcherType
private function isParamFetcherType(\ReflectionParameter $controllerParam) { $type = $controllerParam->getClass(); if (null === $type) { return false; } return $type->implementsInterface(ParamFetcherInterface::class); }
php
private function isParamFetcherType(\ReflectionParameter $controllerParam) { $type = $controllerParam->getClass(); if (null === $type) { return false; } return $type->implementsInterface(ParamFetcherInterface::class); }
[ "private", "function", "isParamFetcherType", "(", "\\", "ReflectionParameter", "$", "controllerParam", ")", "{", "$", "type", "=", "$", "controllerParam", "->", "getClass", "(", ")", ";", "if", "(", "null", "===", "$", "type", ")", "{", "return", "false", ...
Returns true if the given controller parameter is type-hinted as an instance of ParamFetcher. @param \ReflectionParameter $controllerParam A parameter of the controller action @return bool
[ "Returns", "true", "if", "the", "given", "controller", "parameter", "is", "type", "-", "hinted", "as", "an", "instance", "of", "ParamFetcher", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/ParamFetcherListener.php#L113-L121
FriendsOfSymfony/FOSRestBundle
Serializer/SymfonySerializerAdapter.php
SymfonySerializerAdapter.serialize
public function serialize($data, $format, Context $context) { $newContext = $this->convertContext($context); $newContext['serializeNull'] = $context->getSerializeNull(); return $this->serializer->serialize($data, $format, $newContext); }
php
public function serialize($data, $format, Context $context) { $newContext = $this->convertContext($context); $newContext['serializeNull'] = $context->getSerializeNull(); return $this->serializer->serialize($data, $format, $newContext); }
[ "public", "function", "serialize", "(", "$", "data", ",", "$", "format", ",", "Context", "$", "context", ")", "{", "$", "newContext", "=", "$", "this", "->", "convertContext", "(", "$", "context", ")", ";", "$", "newContext", "[", "'serializeNull'", "]",...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/SymfonySerializerAdapter.php#L34-L40
FriendsOfSymfony/FOSRestBundle
Serializer/SymfonySerializerAdapter.php
SymfonySerializerAdapter.deserialize
public function deserialize($data, $type, $format, Context $context) { $newContext = $this->convertContext($context); return $this->serializer->deserialize($data, $type, $format, $newContext); }
php
public function deserialize($data, $type, $format, Context $context) { $newContext = $this->convertContext($context); return $this->serializer->deserialize($data, $type, $format, $newContext); }
[ "public", "function", "deserialize", "(", "$", "data", ",", "$", "type", ",", "$", "format", ",", "Context", "$", "context", ")", "{", "$", "newContext", "=", "$", "this", "->", "convertContext", "(", "$", "context", ")", ";", "return", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/SymfonySerializerAdapter.php#L45-L50
FriendsOfSymfony/FOSRestBundle
EventListener/BodyListener.php
BodyListener.onKernelRequest
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } $method = $request->getMethod(); $contentType = $request->headers->get('Content-Type'); ...
php
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } $method = $request->getMethod(); $contentType = $request->headers->get('Content-Type'); ...
[ "public", "function", "onKernelRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "request", "->", "attributes", "->", "get", "(", "FOSRestBundle", "::", "...
Core request handler. @param GetResponseEvent $event @throws BadRequestHttpException @throws UnsupportedMediaTypeHttpException
[ "Core", "request", "handler", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/BodyListener.php#L77-L131
FriendsOfSymfony/FOSRestBundle
EventListener/BodyListener.php
BodyListener.isNotAnEmptyDeleteRequestWithNoSetContentType
private function isNotAnEmptyDeleteRequestWithNoSetContentType($method, $content, $contentType) { return false === ('DELETE' === $method && empty($content) && empty($contentType)); }
php
private function isNotAnEmptyDeleteRequestWithNoSetContentType($method, $content, $contentType) { return false === ('DELETE' === $method && empty($content) && empty($contentType)); }
[ "private", "function", "isNotAnEmptyDeleteRequestWithNoSetContentType", "(", "$", "method", ",", "$", "content", ",", "$", "contentType", ")", "{", "return", "false", "===", "(", "'DELETE'", "===", "$", "method", "&&", "empty", "(", "$", "content", ")", "&&", ...
Check if the Request is not a DELETE with no content and no Content-Type. @param $method @param $content @param $contentType @return bool
[ "Check", "if", "the", "Request", "is", "not", "a", "DELETE", "with", "no", "content", "and", "no", "Content", "-", "Type", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/BodyListener.php#L142-L145
FriendsOfSymfony/FOSRestBundle
EventListener/BodyListener.php
BodyListener.isDecodeable
protected function isDecodeable(Request $request) { if (!in_array($request->getMethod(), ['POST', 'PUT', 'PATCH', 'DELETE'])) { return false; } return !$this->isFormRequest($request); }
php
protected function isDecodeable(Request $request) { if (!in_array($request->getMethod(), ['POST', 'PUT', 'PATCH', 'DELETE'])) { return false; } return !$this->isFormRequest($request); }
[ "protected", "function", "isDecodeable", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "in_array", "(", "$", "request", "->", "getMethod", "(", ")", ",", "[", "'POST'", ",", "'PUT'", ",", "'PATCH'", ",", "'DELETE'", "]", ")", ")", "{", "r...
Check if we should try to decode the body. @param Request $request @return bool
[ "Check", "if", "we", "should", "try", "to", "decode", "the", "body", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/BodyListener.php#L154-L161
FriendsOfSymfony/FOSRestBundle
EventListener/BodyListener.php
BodyListener.isFormRequest
private function isFormRequest(Request $request) { $contentTypeParts = explode(';', $request->headers->get('Content-Type')); if (isset($contentTypeParts[0])) { return in_array($contentTypeParts[0], ['multipart/form-data', 'application/x-www-form-urlencoded']); } return ...
php
private function isFormRequest(Request $request) { $contentTypeParts = explode(';', $request->headers->get('Content-Type')); if (isset($contentTypeParts[0])) { return in_array($contentTypeParts[0], ['multipart/form-data', 'application/x-www-form-urlencoded']); } return ...
[ "private", "function", "isFormRequest", "(", "Request", "$", "request", ")", "{", "$", "contentTypeParts", "=", "explode", "(", "';'", ",", "$", "request", "->", "headers", "->", "get", "(", "'Content-Type'", ")", ")", ";", "if", "(", "isset", "(", "$", ...
Check if the content type indicates a form submission. @param Request $request @return bool
[ "Check", "if", "the", "content", "type", "indicates", "a", "form", "submission", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/BodyListener.php#L170-L179
FriendsOfSymfony/FOSRestBundle
Context/Context.php
Context.addGroup
public function addGroup($group) { if (null === $this->groups) { $this->groups = []; } if (!in_array($group, $this->groups)) { $this->groups[] = $group; } return $this; }
php
public function addGroup($group) { if (null === $this->groups) { $this->groups = []; } if (!in_array($group, $this->groups)) { $this->groups[] = $group; } return $this; }
[ "public", "function", "addGroup", "(", "$", "group", ")", "{", "if", "(", "null", "===", "$", "this", "->", "groups", ")", "{", "$", "this", "->", "groups", "=", "[", "]", ";", "}", "if", "(", "!", "in_array", "(", "$", "group", ",", "$", "this...
Adds a normalization group. @param string $group @return self
[ "Adds", "a", "normalization", "group", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Context/Context.php#L140-L150
FriendsOfSymfony/FOSRestBundle
Context/Context.php
Context.setMaxDepth
public function setMaxDepth($maxDepth) { if (1 === func_num_args() || func_get_arg(1)) { @trigger_error(sprintf('%s is deprecated since version 2.1 and will be removed in 3.0. Use %s::enableMaxDepth() and %s::disableMaxDepth() instead.', __METHOD__, __CLASS__, __CLASS__), E_USER_DEPRECATED); ...
php
public function setMaxDepth($maxDepth) { if (1 === func_num_args() || func_get_arg(1)) { @trigger_error(sprintf('%s is deprecated since version 2.1 and will be removed in 3.0. Use %s::enableMaxDepth() and %s::disableMaxDepth() instead.', __METHOD__, __CLASS__, __CLASS__), E_USER_DEPRECATED); ...
[ "public", "function", "setMaxDepth", "(", "$", "maxDepth", ")", "{", "if", "(", "1", "===", "func_num_args", "(", ")", "||", "func_get_arg", "(", "1", ")", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'%s is deprecated since version 2.1 and will be remo...
Sets the normalization max depth. @param int|null $maxDepth @return self @deprecated since 2.1, to be removed in 3.0. Use {@link self::enableMaxDepth()} and {@link self::disableMaxDepth()} instead
[ "Sets", "the", "normalization", "max", "depth", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Context/Context.php#L201-L209
FriendsOfSymfony/FOSRestBundle
Context/Context.php
Context.getMaxDepth
public function getMaxDepth() { if (0 === func_num_args() || func_get_arg(0)) { @trigger_error(sprintf('%s is deprecated since version 2.1 and will be removed in 3.0. Use %s::isMaxDepthEnabled() instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED); } return $this->maxDepth; ...
php
public function getMaxDepth() { if (0 === func_num_args() || func_get_arg(0)) { @trigger_error(sprintf('%s is deprecated since version 2.1 and will be removed in 3.0. Use %s::isMaxDepthEnabled() instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED); } return $this->maxDepth; ...
[ "public", "function", "getMaxDepth", "(", ")", "{", "if", "(", "0", "===", "func_num_args", "(", ")", "||", "func_get_arg", "(", "0", ")", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'%s is deprecated since version 2.1 and will be removed in 3.0. Use %s::i...
Gets the normalization max depth. @return int|null @deprecated since version 2.1, to be removed in 3.0. Use {@link self::isMaxDepthEnabled()} instead
[ "Gets", "the", "normalization", "max", "depth", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Context/Context.php#L218-L225
FriendsOfSymfony/FOSRestBundle
Routing/RestRouteCollection.php
RestRouteCollection.prependRouteControllersWithPrefix
public function prependRouteControllersWithPrefix($prefix) { foreach (parent::all() as $route) { $route->setDefault('_controller', $prefix.$route->getDefault('_controller')); } }
php
public function prependRouteControllersWithPrefix($prefix) { foreach (parent::all() as $route) { $route->setDefault('_controller', $prefix.$route->getDefault('_controller')); } }
[ "public", "function", "prependRouteControllersWithPrefix", "(", "$", "prefix", ")", "{", "foreach", "(", "parent", "::", "all", "(", ")", "as", "$", "route", ")", "{", "$", "route", "->", "setDefault", "(", "'_controller'", ",", "$", "prefix", ".", "$", ...
Adds controller prefix to all collection routes. @param string $prefix
[ "Adds", "controller", "prefix", "to", "all", "collection", "routes", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/RestRouteCollection.php#L50-L55
FriendsOfSymfony/FOSRestBundle
Routing/RestRouteCollection.php
RestRouteCollection.setDefaultFormat
public function setDefaultFormat($format) { foreach (parent::all() as $route) { // Set default format only if not set already (could be defined in annotation) if (!$route->getDefault('_format')) { $route->setDefault('_format', $format); } } }
php
public function setDefaultFormat($format) { foreach (parent::all() as $route) { // Set default format only if not set already (could be defined in annotation) if (!$route->getDefault('_format')) { $route->setDefault('_format', $format); } } }
[ "public", "function", "setDefaultFormat", "(", "$", "format", ")", "{", "foreach", "(", "parent", "::", "all", "(", ")", "as", "$", "route", ")", "{", "// Set default format only if not set already (could be defined in annotation)", "if", "(", "!", "$", "route", "...
Sets default format of routes. @param string $format
[ "Sets", "default", "format", "of", "routes", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/RestRouteCollection.php#L62-L70
FriendsOfSymfony/FOSRestBundle
Routing/RestRouteCollection.php
RestRouteCollection.all
public function all() { $regex = '/'. '(_|^)'. '(get|post|put|delete|patch|head|options|mkcol|propfind|proppatch|lock|unlock|move|copy|link|unlink)_'. // allowed http methods '/i'; $routes = parent::all(); $customMethodRoutes = []; foreach ($route...
php
public function all() { $regex = '/'. '(_|^)'. '(get|post|put|delete|patch|head|options|mkcol|propfind|proppatch|lock|unlock|move|copy|link|unlink)_'. // allowed http methods '/i'; $routes = parent::all(); $customMethodRoutes = []; foreach ($route...
[ "public", "function", "all", "(", ")", "{", "$", "regex", "=", "'/'", ".", "'(_|^)'", ".", "'(get|post|put|delete|patch|head|options|mkcol|propfind|proppatch|lock|unlock|move|copy|link|unlink)_'", ".", "// allowed http methods", "'/i'", ";", "$", "routes", "=", "parent", ...
Returns routes sorted by custom HTTP methods first. @return array
[ "Returns", "routes", "sorted", "by", "custom", "HTTP", "methods", "first", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/RestRouteCollection.php#L77-L94
FriendsOfSymfony/FOSRestBundle
DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('fos_rest'); if (method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { $rootNode = $treeBuilder->root('fos_rest'); } $rootNode ...
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('fos_rest'); if (method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { $rootNode = $treeBuilder->root('fos_rest'); } $rootNode ...
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", "'fos_rest'", ")", ";", "if", "(", "method_exists", "(", "$", "treeBuilder", ",", "'getRootNode'", ")", ")", "{", "$", "rootNode", "=", "$", "t...
Generates the configuration tree. @return TreeBuilder
[ "Generates", "the", "configuration", "tree", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/DependencyInjection/Configuration.php#L54-L192
FriendsOfSymfony/FOSRestBundle
Decoder/JsonToFormDecoder.php
JsonToFormDecoder.xWwwFormEncodedLike
private function xWwwFormEncodedLike(&$data) { foreach ($data as $key => &$value) { if (is_array($value)) { // Encode recursively $this->xWwwFormEncodedLike($value); } elseif (false === $value) { // Checkbox-like behavior removes false ...
php
private function xWwwFormEncodedLike(&$data) { foreach ($data as $key => &$value) { if (is_array($value)) { // Encode recursively $this->xWwwFormEncodedLike($value); } elseif (false === $value) { // Checkbox-like behavior removes false ...
[ "private", "function", "xWwwFormEncodedLike", "(", "&", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "&", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "// Encode recursively", "$", "t...
Makes data decoded from JSON application/x-www-form-encoded compliant. @param array $data
[ "Makes", "data", "decoded", "from", "JSON", "application", "/", "x", "-", "www", "-", "form", "-", "encoded", "compliant", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Decoder/JsonToFormDecoder.php#L26-L43
FriendsOfSymfony/FOSRestBundle
Decoder/JsonToFormDecoder.php
JsonToFormDecoder.decode
public function decode($data) { $decodedData = @json_decode($data, true); if ($decodedData) { $this->xWwwFormEncodedLike($decodedData); } return $decodedData; }
php
public function decode($data) { $decodedData = @json_decode($data, true); if ($decodedData) { $this->xWwwFormEncodedLike($decodedData); } return $decodedData; }
[ "public", "function", "decode", "(", "$", "data", ")", "{", "$", "decodedData", "=", "@", "json_decode", "(", "$", "data", ",", "true", ")", ";", "if", "(", "$", "decodedData", ")", "{", "$", "this", "->", "xWwwFormEncodedLike", "(", "$", "decodedData"...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Decoder/JsonToFormDecoder.php#L48-L56
FriendsOfSymfony/FOSRestBundle
Util/ExceptionValueMap.php
ExceptionValueMap.doResolveClass
private function doResolveClass($class) { foreach ($this->map as $mapClass => $value) { if (!$value) { continue; } if ($class === $mapClass || is_subclass_of($class, $mapClass)) { return $value; } } return fals...
php
private function doResolveClass($class) { foreach ($this->map as $mapClass => $value) { if (!$value) { continue; } if ($class === $mapClass || is_subclass_of($class, $mapClass)) { return $value; } } return fals...
[ "private", "function", "doResolveClass", "(", "$", "class", ")", "{", "foreach", "(", "$", "this", "->", "map", "as", "$", "mapClass", "=>", "$", "value", ")", "{", "if", "(", "!", "$", "value", ")", "{", "continue", ";", "}", "if", "(", "$", "cl...
Resolves the value corresponding to an exception class. @param string $class @return mixed|false if not found
[ "Resolves", "the", "value", "corresponding", "to", "an", "exception", "class", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Util/ExceptionValueMap.php#L58-L71
FriendsOfSymfony/FOSRestBundle
Negotiation/FormatNegotiator.php
FormatNegotiator.getBest
public function getBest($header, array $priorities = []) { $request = $this->getRequest(); $header = $header ?: $request->headers->get('Accept'); foreach ($this->map as $elements) { // Check if the current RequestMatcherInterface matches the current request if (!$ele...
php
public function getBest($header, array $priorities = []) { $request = $this->getRequest(); $header = $header ?: $request->headers->get('Accept'); foreach ($this->map as $elements) { // Check if the current RequestMatcherInterface matches the current request if (!$ele...
[ "public", "function", "getBest", "(", "$", "header", ",", "array", "$", "priorities", "=", "[", "]", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", "header", "=", "$", "header", "?", ":", "$", "request", "->", ...
{@inheritdoc} The best format is also determined in function of the bundle configuration. @throws StopFormatListenerException
[ "{", "@inheritdoc", "}", "The", "best", "format", "is", "also", "determined", "in", "function", "of", "the", "bundle", "configuration", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Negotiation/FormatNegotiator.php#L50-L108
FriendsOfSymfony/FOSRestBundle
Negotiation/FormatNegotiator.php
FormatNegotiator.normalizePriorities
private function normalizePriorities(Request $request, array $priorities) { $priorities = $this->sanitize($priorities); $mimeTypes = array(); foreach ($priorities as $priority) { if (strpos($priority, '/')) { $mimeTypes[] = $priority; continue; ...
php
private function normalizePriorities(Request $request, array $priorities) { $priorities = $this->sanitize($priorities); $mimeTypes = array(); foreach ($priorities as $priority) { if (strpos($priority, '/')) { $mimeTypes[] = $priority; continue; ...
[ "private", "function", "normalizePriorities", "(", "Request", "$", "request", ",", "array", "$", "priorities", ")", "{", "$", "priorities", "=", "$", "this", "->", "sanitize", "(", "$", "priorities", ")", ";", "$", "mimeTypes", "=", "array", "(", ")", ";...
Transform the format (json, html, ...) to their mimeType form (application/json, text/html, ...). @param Request $request @param string[] $priorities @return string[] formatted priorities
[ "Transform", "the", "format", "(", "json", "html", "...", ")", "to", "their", "mimeType", "form", "(", "application", "/", "json", "text", "/", "html", "...", ")", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Negotiation/FormatNegotiator.php#L130-L158
FriendsOfSymfony/FOSRestBundle
Controller/TwigExceptionController.php
TwigExceptionController.createView
protected function createView(\Exception $exception, $code, array $templateData, Request $request, $showException) { $view = parent::createView($exception, $code, $templateData, $request, $showException); $view->setTemplate($this->findTemplate($request, $code, $showException)); return $view...
php
protected function createView(\Exception $exception, $code, array $templateData, Request $request, $showException) { $view = parent::createView($exception, $code, $templateData, $request, $showException); $view->setTemplate($this->findTemplate($request, $code, $showException)); return $view...
[ "protected", "function", "createView", "(", "\\", "Exception", "$", "exception", ",", "$", "code", ",", "array", "$", "templateData", ",", "Request", "$", "request", ",", "$", "showException", ")", "{", "$", "view", "=", "parent", "::", "createView", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/TwigExceptionController.php#L25-L31
FriendsOfSymfony/FOSRestBundle
Controller/TwigExceptionController.php
TwigExceptionController.findTemplate
protected function findTemplate(Request $request, $statusCode, $showException) { $format = $request->getRequestFormat(); $name = $showException ? 'exception' : 'error'; if ($showException && 'html' == $format) { $name = 'exception_full'; } // For error pages, tr...
php
protected function findTemplate(Request $request, $statusCode, $showException) { $format = $request->getRequestFormat(); $name = $showException ? 'exception' : 'error'; if ($showException && 'html' == $format) { $name = 'exception_full'; } // For error pages, tr...
[ "protected", "function", "findTemplate", "(", "Request", "$", "request", ",", "$", "statusCode", ",", "$", "showException", ")", "{", "$", "format", "=", "$", "request", "->", "getRequestFormat", "(", ")", ";", "$", "name", "=", "$", "showException", "?", ...
{@inheritdoc} This code is inspired by TwigBundle and should be synchronized on a regular basis see src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
[ "{", "@inheritdoc", "}" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/TwigExceptionController.php#L39-L66
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.supports
public function supports($format) { return isset($this->customHandlers[$format]) || isset($this->formats[$format]); }
php
public function supports($format) { return isset($this->customHandlers[$format]) || isset($this->formats[$format]); }
[ "public", "function", "supports", "(", "$", "format", ")", "{", "return", "isset", "(", "$", "this", "->", "customHandlers", "[", "$", "format", "]", ")", "||", "isset", "(", "$", "this", "->", "formats", "[", "$", "format", "]", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L186-L189
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.getStatusCode
protected function getStatusCode(View $view, $content = null) { $form = $this->getFormFromView($view); if ($form && $form->isSubmitted() && !$form->isValid()) { return $this->failedValidationCode; } $statusCode = $view->getStatusCode(); if (null !== $statusCode)...
php
protected function getStatusCode(View $view, $content = null) { $form = $this->getFormFromView($view); if ($form && $form->isSubmitted() && !$form->isValid()) { return $this->failedValidationCode; } $statusCode = $view->getStatusCode(); if (null !== $statusCode)...
[ "protected", "function", "getStatusCode", "(", "View", "$", "view", ",", "$", "content", "=", "null", ")", "{", "$", "form", "=", "$", "this", "->", "getFormFromView", "(", "$", "view", ")", ";", "if", "(", "$", "form", "&&", "$", "form", "->", "is...
Gets a response HTTP status code from a View instance. By default it will return 200. However if there is a FormInterface stored for the key 'form' in the View's data it will return the failed_validation configuration if the form instance has errors. @param View $view @param mixed $content @return int HTTP status c...
[ "Gets", "a", "response", "HTTP", "status", "code", "from", "a", "View", "instance", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L224-L238
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.getSerializationContext
protected function getSerializationContext(View $view) { $context = $view->getContext(); $groups = $context->getGroups(); if (empty($groups) && $this->exclusionStrategyGroups) { $context->setGroups($this->exclusionStrategyGroups); } if (null === $context->getVer...
php
protected function getSerializationContext(View $view) { $context = $view->getContext(); $groups = $context->getGroups(); if (empty($groups) && $this->exclusionStrategyGroups) { $context->setGroups($this->exclusionStrategyGroups); } if (null === $context->getVer...
[ "protected", "function", "getSerializationContext", "(", "View", "$", "view", ")", "{", "$", "context", "=", "$", "view", "->", "getContext", "(", ")", ";", "$", "groups", "=", "$", "context", "->", "getGroups", "(", ")", ";", "if", "(", "empty", "(", ...
Gets or creates a JMS\Serializer\SerializationContext and initializes it with the view exclusion strategies, groups & versions if a new context is created. @param View $view @return Context
[ "Gets", "or", "creates", "a", "JMS", "\\", "Serializer", "\\", "SerializationContext", "and", "initializes", "it", "with", "the", "view", "exclusion", "strategies", "groups", "&", "versions", "if", "a", "new", "context", "is", "created", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L260-L278
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.handle
public function handle(View $view, Request $request = null) { if (null === $request) { $request = $this->requestStack->getCurrentRequest(); } $format = $view->getFormat() ?: $request->getRequestFormat(); if (!$this->supports($format)) { $msg = "Format '$form...
php
public function handle(View $view, Request $request = null) { if (null === $request) { $request = $this->requestStack->getCurrentRequest(); } $format = $view->getFormat() ?: $request->getRequestFormat(); if (!$this->supports($format)) { $msg = "Format '$form...
[ "public", "function", "handle", "(", "View", "$", "view", ",", "Request", "$", "request", "=", "null", ")", "{", "if", "(", "null", "===", "$", "request", ")", "{", "$", "request", "=", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(",...
Handles a request with the proper handler. Decides on which handler to use based on the request format. @param View $view @param Request $request @throws UnsupportedMediaTypeHttpException @return Response
[ "Handles", "a", "request", "with", "the", "proper", "handler", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L292-L311
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.createRedirectResponse
public function createRedirectResponse(View $view, $location, $format) { $content = null; if ((Response::HTTP_CREATED === $view->getStatusCode() || Response::HTTP_ACCEPTED === $view->getStatusCode()) && null !== $view->getData()) { $response = $this->initResponse($view, $format); ...
php
public function createRedirectResponse(View $view, $location, $format) { $content = null; if ((Response::HTTP_CREATED === $view->getStatusCode() || Response::HTTP_ACCEPTED === $view->getStatusCode()) && null !== $view->getData()) { $response = $this->initResponse($view, $format); ...
[ "public", "function", "createRedirectResponse", "(", "View", "$", "view", ",", "$", "location", ",", "$", "format", ")", "{", "$", "content", "=", "null", ";", "if", "(", "(", "Response", "::", "HTTP_CREATED", "===", "$", "view", "->", "getStatusCode", "...
Creates the Response from the view. @param View $view @param string $location @param string $format @return Response
[ "Creates", "the", "Response", "from", "the", "view", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L322-L343
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.renderTemplate
public function renderTemplate(View $view, $format) { if (null === $this->templating) { throw new \LogicException(sprintf('An instance of %s must be injected in %s to render templates.', EngineInterface::class, __CLASS__)); } $data = $this->prepareTemplateParameters($view); ...
php
public function renderTemplate(View $view, $format) { if (null === $this->templating) { throw new \LogicException(sprintf('An instance of %s must be injected in %s to render templates.', EngineInterface::class, __CLASS__)); } $data = $this->prepareTemplateParameters($view); ...
[ "public", "function", "renderTemplate", "(", "View", "$", "view", ",", "$", "format", ")", "{", "if", "(", "null", "===", "$", "this", "->", "templating", ")", "{", "throw", "new", "\\", "LogicException", "(", "sprintf", "(", "'An instance of %s must be inje...
Renders the view data with the given template. @param View $view @param string $format @return string
[ "Renders", "the", "view", "data", "with", "the", "given", "template", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L353-L374
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.prepareTemplateParameters
public function prepareTemplateParameters(View $view) { $data = $view->getData(); if ($data instanceof FormInterface) { $data = [$view->getTemplateVar() => $data->getData(), 'form' => $data]; } elseif (empty($data) || !is_array($data) || is_numeric((key($data)))) { $...
php
public function prepareTemplateParameters(View $view) { $data = $view->getData(); if ($data instanceof FormInterface) { $data = [$view->getTemplateVar() => $data->getData(), 'form' => $data]; } elseif (empty($data) || !is_array($data) || is_numeric((key($data)))) { $...
[ "public", "function", "prepareTemplateParameters", "(", "View", "$", "view", ")", "{", "$", "data", "=", "$", "view", "->", "getData", "(", ")", ";", "if", "(", "$", "data", "instanceof", "FormInterface", ")", "{", "$", "data", "=", "[", "$", "view", ...
Prepares view data for use by templating engine. @param View $view @return array
[ "Prepares", "view", "data", "for", "use", "by", "templating", "engine", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L383-L403
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.createResponse
public function createResponse(View $view, Request $request, $format) { $route = $view->getRoute(); $location = $route ? $this->urlGenerator->generate($route, (array) $view->getRouteParameters(), UrlGeneratorInterface::ABSOLUTE_URL) : $view->getLocation(); if ($loca...
php
public function createResponse(View $view, Request $request, $format) { $route = $view->getRoute(); $location = $route ? $this->urlGenerator->generate($route, (array) $view->getRouteParameters(), UrlGeneratorInterface::ABSOLUTE_URL) : $view->getLocation(); if ($loca...
[ "public", "function", "createResponse", "(", "View", "$", "view", ",", "Request", "$", "request", ",", "$", "format", ")", "{", "$", "route", "=", "$", "view", "->", "getRoute", "(", ")", ";", "$", "location", "=", "$", "route", "?", "$", "this", "...
Handles creation of a Response using either redirection or the templating/serializer service. @param View $view @param Request $request @param string $format @return Response
[ "Handles", "creation", "of", "a", "Response", "using", "either", "redirection", "or", "the", "templating", "/", "serializer", "service", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L414-L438
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.initResponse
private function initResponse(View $view, $format) { $content = null; if ($this->isFormatTemplating($format)) { $content = $this->renderTemplate($view, $format); } elseif ($this->serializeNull || null !== $view->getData()) { $data = $this->getDataFromView($view); ...
php
private function initResponse(View $view, $format) { $content = null; if ($this->isFormatTemplating($format)) { $content = $this->renderTemplate($view, $format); } elseif ($this->serializeNull || null !== $view->getData()) { $data = $this->getDataFromView($view); ...
[ "private", "function", "initResponse", "(", "View", "$", "view", ",", "$", "format", ")", "{", "$", "content", "=", "null", ";", "if", "(", "$", "this", "->", "isFormatTemplating", "(", "$", "format", ")", ")", "{", "$", "content", "=", "$", "this", ...
Initializes a response object that represents the view and holds the view's status code. @param View $view @param string $format @return Response
[ "Initializes", "a", "response", "object", "that", "represents", "the", "view", "and", "holds", "the", "view", "s", "status", "code", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L448-L474
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.getFormFromView
protected function getFormFromView(View $view) { $data = $view->getData(); if ($data instanceof FormInterface) { return $data; } if (is_array($data) && isset($data['form']) && $data['form'] instanceof FormInterface) { return $data['form']; } ...
php
protected function getFormFromView(View $view) { $data = $view->getData(); if ($data instanceof FormInterface) { return $data; } if (is_array($data) && isset($data['form']) && $data['form'] instanceof FormInterface) { return $data['form']; } ...
[ "protected", "function", "getFormFromView", "(", "View", "$", "view", ")", "{", "$", "data", "=", "$", "view", "->", "getData", "(", ")", ";", "if", "(", "$", "data", "instanceof", "FormInterface", ")", "{", "return", "$", "data", ";", "}", "if", "("...
Returns the form from the given view if present, false otherwise. @param View $view @return bool|FormInterface
[ "Returns", "the", "form", "from", "the", "given", "view", "if", "present", "false", "otherwise", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L483-L496
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.getDataFromView
private function getDataFromView(View $view) { $form = $this->getFormFromView($view); if (false === $form) { return $view->getData(); } return $form; }
php
private function getDataFromView(View $view) { $form = $this->getFormFromView($view); if (false === $form) { return $view->getData(); } return $form; }
[ "private", "function", "getDataFromView", "(", "View", "$", "view", ")", "{", "$", "form", "=", "$", "this", "->", "getFormFromView", "(", "$", "view", ")", ";", "if", "(", "false", "===", "$", "form", ")", "{", "return", "$", "view", "->", "getData"...
Returns the data from a view. @param View $view @return mixed|null
[ "Returns", "the", "data", "from", "a", "view", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L505-L514
FriendsOfSymfony/FOSRestBundle
View/ViewHandler.php
ViewHandler.reset
public function reset() { $this->exclusionStrategyGroups = $this->options['exclusionStrategyGroups']; $this->exclusionStrategyVersion = $this->options['exclusionStrategyVersion']; $this->serializeNullStrategy = $this->options['serializeNullStrategy']; }
php
public function reset() { $this->exclusionStrategyGroups = $this->options['exclusionStrategyGroups']; $this->exclusionStrategyVersion = $this->options['exclusionStrategyVersion']; $this->serializeNullStrategy = $this->options['serializeNullStrategy']; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "exclusionStrategyGroups", "=", "$", "this", "->", "options", "[", "'exclusionStrategyGroups'", "]", ";", "$", "this", "->", "exclusionStrategyVersion", "=", "$", "this", "->", "options", "[", ...
Resets internal object state at the end of the request.
[ "Resets", "internal", "object", "state", "at", "the", "end", "of", "the", "request", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/ViewHandler.php#L519-L524
FriendsOfSymfony/FOSRestBundle
Controller/Annotations/AbstractScalarParam.php
AbstractScalarParam.getConstraints
public function getConstraints() { $constraints = parent::getConstraints(); if ($this->requirements instanceof Constraint) { $constraints[] = $this->requirements; } elseif (is_scalar($this->requirements)) { $constraints[] = new Regex(array( 'pattern' ...
php
public function getConstraints() { $constraints = parent::getConstraints(); if ($this->requirements instanceof Constraint) { $constraints[] = $this->requirements; } elseif (is_scalar($this->requirements)) { $constraints[] = new Regex(array( 'pattern' ...
[ "public", "function", "getConstraints", "(", ")", "{", "$", "constraints", "=", "parent", "::", "getConstraints", "(", ")", ";", "if", "(", "$", "this", "->", "requirements", "instanceof", "Constraint", ")", "{", "$", "constraints", "[", "]", "=", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/Annotations/AbstractScalarParam.php#L37-L83
FriendsOfSymfony/FOSRestBundle
View/View.php
View.createRedirect
public static function createRedirect($url, $statusCode = Response::HTTP_FOUND, array $headers = []) { $view = static::create(null, $statusCode, $headers); $view->setLocation($url); return $view; }
php
public static function createRedirect($url, $statusCode = Response::HTTP_FOUND, array $headers = []) { $view = static::create(null, $statusCode, $headers); $view->setLocation($url); return $view; }
[ "public", "static", "function", "createRedirect", "(", "$", "url", ",", "$", "statusCode", "=", "Response", "::", "HTTP_FOUND", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "view", "=", "static", "::", "create", "(", "null", ",", "$", ...
Convenience method to allow for a fluent interface while creating a redirect to a given url. @param string $url @param int $statusCode @param array $headers @return static
[ "Convenience", "method", "to", "allow", "for", "a", "fluent", "interface", "while", "creating", "a", "redirect", "to", "a", "given", "url", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/View.php#L110-L116
FriendsOfSymfony/FOSRestBundle
View/View.php
View.createRouteRedirect
public static function createRouteRedirect( $route, array $parameters = [], $statusCode = Response::HTTP_FOUND, array $headers = [] ) { $view = static::create(null, $statusCode, $headers); $view->setRoute($route); $view->setRouteParameters($parameters); ...
php
public static function createRouteRedirect( $route, array $parameters = [], $statusCode = Response::HTTP_FOUND, array $headers = [] ) { $view = static::create(null, $statusCode, $headers); $view->setRoute($route); $view->setRouteParameters($parameters); ...
[ "public", "static", "function", "createRouteRedirect", "(", "$", "route", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "statusCode", "=", "Response", "::", "HTTP_FOUND", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "view", "...
Convenience method to allow for a fluent interface while creating a redirect to a given route. @param string $route @param array $parameters @param int $statusCode @param array $headers @return static
[ "Convenience", "method", "to", "allow", "for", "a", "fluent", "interface", "while", "creating", "a", "redirect", "to", "a", "given", "route", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/View.php#L129-L140
FriendsOfSymfony/FOSRestBundle
View/View.php
View.setHeader
public function setHeader($name, $value) { $this->getResponse()->headers->set($name, $value); return $this; }
php
public function setHeader($name, $value) { $this->getResponse()->headers->set($name, $value); return $this; }
[ "public", "function", "setHeader", "(", "$", "name", ",", "$", "value", ")", "{", "$", "this", "->", "getResponse", "(", ")", "->", "headers", "->", "set", "(", "$", "name", ",", "$", "value", ")", ";", "return", "$", "this", ";", "}" ]
Sets a header. @param string $name @param string $value @return View
[ "Sets", "a", "header", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/View.php#L196-L201
FriendsOfSymfony/FOSRestBundle
View/View.php
View.setTemplate
public function setTemplate($template) { if (!(is_string($template) || $template instanceof TemplateReferenceInterface)) { throw new \InvalidArgumentException('The template should be a string or implement TemplateReferenceInterface'); } $this->template = $template; retur...
php
public function setTemplate($template) { if (!(is_string($template) || $template instanceof TemplateReferenceInterface)) { throw new \InvalidArgumentException('The template should be a string or implement TemplateReferenceInterface'); } $this->template = $template; retur...
[ "public", "function", "setTemplate", "(", "$", "template", ")", "{", "if", "(", "!", "(", "is_string", "(", "$", "template", ")", "||", "$", "template", "instanceof", "TemplateReferenceInterface", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException"...
Sets template to use for the encoding. @param string|TemplateReferenceInterface $template @return View @throws \InvalidArgumentException if the template is neither a string nor an instance of TemplateReferenceInterface
[ "Sets", "template", "to", "use", "for", "the", "encoding", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/View.php#L256-L264
FriendsOfSymfony/FOSRestBundle
View/View.php
View.getResponse
public function getResponse() { if (null === $this->response) { $this->response = new Response(); if (null !== ($code = $this->getStatusCode())) { $this->response->setStatusCode($code); } } return $this->response; }
php
public function getResponse() { if (null === $this->response) { $this->response = new Response(); if (null !== ($code = $this->getStatusCode())) { $this->response->setStatusCode($code); } } return $this->response; }
[ "public", "function", "getResponse", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "response", ")", "{", "$", "this", "->", "response", "=", "new", "Response", "(", ")", ";", "if", "(", "null", "!==", "(", "$", "code", "=", "$", "th...
Gets the response. @return Response
[ "Gets", "the", "response", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/View.php#L481-L492
FriendsOfSymfony/FOSRestBundle
Serializer/Normalizer/ExceptionNormalizer.php
ExceptionNormalizer.normalize
public function normalize($object, $format = null, array $context = []) { $data = []; if (isset($context['template_data']['status_code'])) { $data['code'] = $statusCode = $context['template_data']['status_code']; } $data['message'] = $this->getExceptionMessage($object, ...
php
public function normalize($object, $format = null, array $context = []) { $data = []; if (isset($context['template_data']['status_code'])) { $data['code'] = $statusCode = $context['template_data']['status_code']; } $data['message'] = $this->getExceptionMessage($object, ...
[ "public", "function", "normalize", "(", "$", "object", ",", "$", "format", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "$", "data", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "context", "[", "'template_data'", "]", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/Normalizer/ExceptionNormalizer.php#L26-L37
FriendsOfSymfony/FOSRestBundle
Serializer/JMSSerializerAdapter.php
JMSSerializerAdapter.serialize
public function serialize($data, $format, Context $context) { $context = $this->convertContext($context, self::SERIALIZATION); return $this->serializer->serialize($data, $format, $context); }
php
public function serialize($data, $format, Context $context) { $context = $this->convertContext($context, self::SERIALIZATION); return $this->serializer->serialize($data, $format, $context); }
[ "public", "function", "serialize", "(", "$", "data", ",", "$", "format", ",", "Context", "$", "context", ")", "{", "$", "context", "=", "$", "this", "->", "convertContext", "(", "$", "context", ",", "self", "::", "SERIALIZATION", ")", ";", "return", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/JMSSerializerAdapter.php#L56-L61
FriendsOfSymfony/FOSRestBundle
Serializer/JMSSerializerAdapter.php
JMSSerializerAdapter.deserialize
public function deserialize($data, $type, $format, Context $context) { $context = $this->convertContext($context, self::DESERIALIZATION); return $this->serializer->deserialize($data, $type, $format, $context); }
php
public function deserialize($data, $type, $format, Context $context) { $context = $this->convertContext($context, self::DESERIALIZATION); return $this->serializer->deserialize($data, $type, $format, $context); }
[ "public", "function", "deserialize", "(", "$", "data", ",", "$", "type", ",", "$", "format", ",", "Context", "$", "context", ")", "{", "$", "context", "=", "$", "this", "->", "convertContext", "(", "$", "context", ",", "self", "::", "DESERIALIZATION", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/JMSSerializerAdapter.php#L66-L71
FriendsOfSymfony/FOSRestBundle
Serializer/JMSSerializerAdapter.php
JMSSerializerAdapter.convertContext
private function convertContext(Context $context, $direction) { if (self::SERIALIZATION === $direction) { $jmsContext = $this->serializationContextFactory ? $this->serializationContextFactory->createSerializationContext() : SerializationContext::create(); ...
php
private function convertContext(Context $context, $direction) { if (self::SERIALIZATION === $direction) { $jmsContext = $this->serializationContextFactory ? $this->serializationContextFactory->createSerializationContext() : SerializationContext::create(); ...
[ "private", "function", "convertContext", "(", "Context", "$", "context", ",", "$", "direction", ")", "{", "if", "(", "self", "::", "SERIALIZATION", "===", "$", "direction", ")", "{", "$", "jmsContext", "=", "$", "this", "->", "serializationContextFactory", "...
@param Context $context @param int $direction {@see self} constants @return JMSContext
[ "@param", "Context", "$context", "@param", "int", "$direction", "{", "@see", "self", "}", "constants" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/JMSSerializerAdapter.php#L79-L119
FriendsOfSymfony/FOSRestBundle
Controller/Annotations/FileParam.php
FileParam.getConstraints
public function getConstraints() { $constraints = parent::getConstraints(); if ($this->requirements instanceof Constraint) { $constraints[] = $this->requirements; } $options = is_array($this->requirements) ? $this->requirements : array(); if ($this->image) { ...
php
public function getConstraints() { $constraints = parent::getConstraints(); if ($this->requirements instanceof Constraint) { $constraints[] = $this->requirements; } $options = is_array($this->requirements) ? $this->requirements : array(); if ($this->image) { ...
[ "public", "function", "getConstraints", "(", ")", "{", "$", "constraints", "=", "parent", "::", "getConstraints", "(", ")", ";", "if", "(", "$", "this", "->", "requirements", "instanceof", "Constraint", ")", "{", "$", "constraints", "[", "]", "=", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/Annotations/FileParam.php#L44-L66
FriendsOfSymfony/FOSRestBundle
Normalizer/CamelKeysNormalizer.php
CamelKeysNormalizer.normalizeArray
private function normalizeArray(array &$data) { $normalizedData = array(); foreach ($data as $key => $val) { $normalizedKey = $this->normalizeString($key); if ($normalizedKey !== $key) { if (array_key_exists($normalizedKey, $normalizedData)) { ...
php
private function normalizeArray(array &$data) { $normalizedData = array(); foreach ($data as $key => $val) { $normalizedKey = $this->normalizeString($key); if ($normalizedKey !== $key) { if (array_key_exists($normalizedKey, $normalizedData)) { ...
[ "private", "function", "normalizeArray", "(", "array", "&", "$", "data", ")", "{", "$", "normalizedData", "=", "array", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "normalizedKey", "=", "$", "this", ...
Normalizes an array. @param array &$data @throws Exception\NormalizationException
[ "Normalizes", "an", "array", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Normalizer/CamelKeysNormalizer.php#L40-L66
FriendsOfSymfony/FOSRestBundle
Normalizer/CamelKeysNormalizer.php
CamelKeysNormalizer.normalizeString
protected function normalizeString($string) { if (false === strpos($string, '_')) { return $string; } return preg_replace_callback('/_([a-zA-Z0-9])/', function ($matches) { return strtoupper($matches[1]); }, $string); }
php
protected function normalizeString($string) { if (false === strpos($string, '_')) { return $string; } return preg_replace_callback('/_([a-zA-Z0-9])/', function ($matches) { return strtoupper($matches[1]); }, $string); }
[ "protected", "function", "normalizeString", "(", "$", "string", ")", "{", "if", "(", "false", "===", "strpos", "(", "$", "string", ",", "'_'", ")", ")", "{", "return", "$", "string", ";", "}", "return", "preg_replace_callback", "(", "'/_([a-zA-Z0-9])/'", "...
Normalizes a string. @param string $string @return string
[ "Normalizes", "a", "string", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Normalizer/CamelKeysNormalizer.php#L75-L84
FriendsOfSymfony/FOSRestBundle
Resources/doc/examples/RssHandler.php
RssHandler.createResponse
public function createResponse(ViewHandler $handler, View $view, Request $request) { try { $content = $this->createFeed($view->getData()); $code = Response::HTTP_OK; } catch (\Exception $e) { if ($this->logger) { $this->logger->error($e); ...
php
public function createResponse(ViewHandler $handler, View $view, Request $request) { try { $content = $this->createFeed($view->getData()); $code = Response::HTTP_OK; } catch (\Exception $e) { if ($this->logger) { $this->logger->error($e); ...
[ "public", "function", "createResponse", "(", "ViewHandler", "$", "handler", ",", "View", "$", "view", ",", "Request", "$", "request", ")", "{", "try", "{", "$", "content", "=", "$", "this", "->", "createFeed", "(", "$", "view", "->", "getData", "(", ")...
Converts the viewdata to a RSS feed. Modify to suit your datastructure. @return Response
[ "Converts", "the", "viewdata", "to", "a", "RSS", "feed", ".", "Modify", "to", "suit", "your", "datastructure", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Resources/doc/examples/RssHandler.php#L61-L76
FriendsOfSymfony/FOSRestBundle
Version/Resolver/MediaTypeVersionResolver.php
MediaTypeVersionResolver.resolve
public function resolve(Request $request) { if (!$request->attributes->has('media_type') || false === preg_match($this->regex, $request->attributes->get('media_type'), $matches)) { return false; } return isset($matches['version']) ? $matches['version'] : false; }
php
public function resolve(Request $request) { if (!$request->attributes->has('media_type') || false === preg_match($this->regex, $request->attributes->get('media_type'), $matches)) { return false; } return isset($matches['version']) ? $matches['version'] : false; }
[ "public", "function", "resolve", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "$", "request", "->", "attributes", "->", "has", "(", "'media_type'", ")", "||", "false", "===", "preg_match", "(", "$", "this", "->", "regex", ",", "$", "reques...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Version/Resolver/MediaTypeVersionResolver.php#L38-L45
FriendsOfSymfony/FOSRestBundle
EventListener/FormatListener.php
FormatListener.onKernelRequest
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } try { $format = $request->getRequestFormat(null); if (null === $format) {...
php
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } try { $format = $request->getRequestFormat(null); if (null === $format) {...
[ "public", "function", "onKernelRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "request", "->", "attributes", "->", "get", "(", "FOSRestBundle", "::", "...
Determines and sets the Request format. @param GetResponseEvent $event The event @throws NotAcceptableHttpException
[ "Determines", "and", "sets", "the", "Request", "format", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/FormatListener.php#L49-L81
FriendsOfSymfony/FOSRestBundle
Util/ResolverTrait.php
ResolverTrait.resolveValue
private function resolveValue(ContainerInterface $container, $value) { if (is_array($value)) { foreach ($value as $key => $val) { $value[$key] = $this->resolveValue($container, $val); } return $value; } if (!is_string($value)) { ...
php
private function resolveValue(ContainerInterface $container, $value) { if (is_array($value)) { foreach ($value as $key => $val) { $value[$key] = $this->resolveValue($container, $val); } return $value; } if (!is_string($value)) { ...
[ "private", "function", "resolveValue", "(", "ContainerInterface", "$", "container", ",", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "foreach", "(", "$", "value", "as", "$", "key", "=>", "$", "val", ")", "{", "$",...
@param ContainerInterface $container @param mixed $value @return mixed
[ "@param", "ContainerInterface", "$container", "@param", "mixed", "$value" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Util/ResolverTrait.php#L29-L63
FriendsOfSymfony/FOSRestBundle
View/JsonpHandler.php
JsonpHandler.createResponse
public function createResponse(ViewHandler $handler, View $view, Request $request, $format) { $response = $handler->createResponse($view, $request, 'json'); if ($response->isSuccessful()) { $callback = $this->getCallback($request); $response->setContent(sprintf('/**/%s(%s)',...
php
public function createResponse(ViewHandler $handler, View $view, Request $request, $format) { $response = $handler->createResponse($view, $request, 'json'); if ($response->isSuccessful()) { $callback = $this->getCallback($request); $response->setContent(sprintf('/**/%s(%s)',...
[ "public", "function", "createResponse", "(", "ViewHandler", "$", "handler", ",", "View", "$", "view", ",", "Request", "$", "request", ",", "$", "format", ")", "{", "$", "response", "=", "$", "handler", "->", "createResponse", "(", "$", "view", ",", "$", ...
Handles wrapping a JSON response into a JSONP response. @param ViewHandler $handler @param View $view @param Request $request @param string $format @return Response
[ "Handles", "wrapping", "a", "JSON", "response", "into", "a", "JSONP", "response", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/View/JsonpHandler.php#L54-L65
FriendsOfSymfony/FOSRestBundle
EventListener/ViewResponseListener.php
ViewResponseListener.onKernelView
public function onKernelView(GetResponseForControllerResultEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return false; } $configuration = $request->attributes->get('_template'); $view = $...
php
public function onKernelView(GetResponseForControllerResultEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return false; } $configuration = $request->attributes->get('_template'); $view = $...
[ "public", "function", "onKernelView", "(", "GetResponseForControllerResultEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "request", "->", "attributes", "->", "get", "(", "FOSRestBund...
Renders the parameters and template and initializes a new response object with the rendered content. @param GetResponseForControllerResultEvent $event
[ "Renders", "the", "parameters", "and", "template", "and", "initializes", "a", "new", "response", "object", "with", "the", "rendered", "content", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/ViewResponseListener.php#L55-L135
FriendsOfSymfony/FOSRestBundle
EventListener/ViewResponseListener.php
ViewResponseListener.getDefaultVars
private function getDefaultVars(Template $template = null, $controller, $action) { if (0 !== count($arguments = $template->getVars())) { return $arguments; } if (!$template instanceof ViewAnnotation || $template->isPopulateDefaultVars()) { $r = new \ReflectionObject(...
php
private function getDefaultVars(Template $template = null, $controller, $action) { if (0 !== count($arguments = $template->getVars())) { return $arguments; } if (!$template instanceof ViewAnnotation || $template->isPopulateDefaultVars()) { $r = new \ReflectionObject(...
[ "private", "function", "getDefaultVars", "(", "Template", "$", "template", "=", "null", ",", "$", "controller", ",", "$", "action", ")", "{", "if", "(", "0", "!==", "count", "(", "$", "arguments", "=", "$", "template", "->", "getVars", "(", ")", ")", ...
@param Template $template @param object $controller @param string $action @return array @see \Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::resolveDefaultParameters()
[ "@param", "Template", "$template", "@param", "object", "$controller", "@param", "string", "$action" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/ViewResponseListener.php#L154-L170
FriendsOfSymfony/FOSRestBundle
Normalizer/CamelKeysNormalizerWithLeadingUnderscore.php
CamelKeysNormalizerWithLeadingUnderscore.normalizeString
protected function normalizeString($string) { if (false === strpos($string, '_')) { return $string; } $offset = strspn($string, '_'); if ($offset) { $underscorePrefix = substr($string, 0, $offset); $string = substr($string, $offset); } els...
php
protected function normalizeString($string) { if (false === strpos($string, '_')) { return $string; } $offset = strspn($string, '_'); if ($offset) { $underscorePrefix = substr($string, 0, $offset); $string = substr($string, $offset); } els...
[ "protected", "function", "normalizeString", "(", "$", "string", ")", "{", "if", "(", "false", "===", "strpos", "(", "$", "string", ",", "'_'", ")", ")", "{", "return", "$", "string", ";", "}", "$", "offset", "=", "strspn", "(", "$", "string", ",", ...
Normalizes a string while leaving leading underscores unchanged. @param string $string @return string
[ "Normalizes", "a", "string", "while", "leaving", "leading", "underscores", "unchanged", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Normalizer/CamelKeysNormalizerWithLeadingUnderscore.php#L29-L44
FriendsOfSymfony/FOSRestBundle
Request/ParameterBag.php
ParameterBag.initParams
private function initParams($requestId) { $controller = $this->params[$requestId]['controller']; if (!is_array($controller) || empty($controller[0]) || !is_object($controller[0])) { throw new \InvalidArgumentException( 'Controller needs to be set as a class instance (clos...
php
private function initParams($requestId) { $controller = $this->params[$requestId]['controller']; if (!is_array($controller) || empty($controller[0]) || !is_object($controller[0])) { throw new \InvalidArgumentException( 'Controller needs to be set as a class instance (clos...
[ "private", "function", "initParams", "(", "$", "requestId", ")", "{", "$", "controller", "=", "$", "this", "->", "params", "[", "$", "requestId", "]", "[", "'controller'", "]", ";", "if", "(", "!", "is_array", "(", "$", "controller", ")", "||", "empty"...
Initialize the parameters. @param string $requestId @return ParamInterface[] @throws \InvalidArgumentException @throws \ReflectionException
[ "Initialize", "the", "parameters", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/ParameterBag.php#L73-L90
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestControllerReader.php
RestControllerReader.read
public function read(\ReflectionClass $reflectionClass) { $collection = new RestRouteCollection(); $collection->addResource(new FileResource($reflectionClass->getFileName())); // read prefix annotation if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, A...
php
public function read(\ReflectionClass $reflectionClass) { $collection = new RestRouteCollection(); $collection->addResource(new FileResource($reflectionClass->getFileName())); // read prefix annotation if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, A...
[ "public", "function", "read", "(", "\\", "ReflectionClass", "$", "reflectionClass", ")", "{", "$", "collection", "=", "new", "RestRouteCollection", "(", ")", ";", "$", "collection", "->", "addResource", "(", "new", "FileResource", "(", "$", "reflectionClass", ...
Reads controller routes. @param \ReflectionClass $reflectionClass @throws \InvalidArgumentException @return RestRouteCollection
[ "Reads", "controller", "routes", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestControllerReader.php#L61-L112
FriendsOfSymfony/FOSRestBundle
Version/Resolver/HeaderVersionResolver.php
HeaderVersionResolver.resolve
public function resolve(Request $request) { if (!$request->headers->has($this->headerName)) { return false; } $header = $request->headers->get($this->headerName); return is_scalar($header) ? $header : strval($header); }
php
public function resolve(Request $request) { if (!$request->headers->has($this->headerName)) { return false; } $header = $request->headers->get($this->headerName); return is_scalar($header) ? $header : strval($header); }
[ "public", "function", "resolve", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "$", "request", "->", "headers", "->", "has", "(", "$", "this", "->", "headerName", ")", ")", "{", "return", "false", ";", "}", "$", "header", "=", "$", "req...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Version/Resolver/HeaderVersionResolver.php#L38-L47
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.read
public function read(RestRouteCollection $collection, \ReflectionMethod $method, $resource) { // check that every route parent has non-empty singular name foreach ($this->parents as $parent) { if (empty($parent) || '/' === substr($parent, -1)) { throw new \InvalidArgument...
php
public function read(RestRouteCollection $collection, \ReflectionMethod $method, $resource) { // check that every route parent has non-empty singular name foreach ($this->parents as $parent) { if (empty($parent) || '/' === substr($parent, -1)) { throw new \InvalidArgument...
[ "public", "function", "read", "(", "RestRouteCollection", "$", "collection", ",", "\\", "ReflectionMethod", "$", "method", ",", "$", "resource", ")", "{", "// check that every route parent has non-empty singular name", "foreach", "(", "$", "this", "->", "parents", "as...
Reads action route. @param RestRouteCollection $collection @param \ReflectionMethod $method @param string[] $resource @throws \InvalidArgumentException @return Route
[ "Reads", "action", "route", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L248-L361
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.combineConditions
private function combineConditions($conditionOne, $conditionTwo) { if (null === $conditionOne) { return $conditionTwo; } if (null === $conditionTwo) { return $conditionOne; } return sprintf('(%s) and (%s)', $conditionOne, $conditionTwo); }
php
private function combineConditions($conditionOne, $conditionTwo) { if (null === $conditionOne) { return $conditionTwo; } if (null === $conditionTwo) { return $conditionOne; } return sprintf('(%s) and (%s)', $conditionOne, $conditionTwo); }
[ "private", "function", "combineConditions", "(", "$", "conditionOne", ",", "$", "conditionTwo", ")", "{", "if", "(", "null", "===", "$", "conditionOne", ")", "{", "return", "$", "conditionTwo", ";", "}", "if", "(", "null", "===", "$", "conditionTwo", ")", ...
@param string|null $conditionOne @param string|null $conditionTwo @return string|null
[ "@param", "string|null", "$conditionOne", "@param", "string|null", "$conditionTwo" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L381-L392
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.includeFormatIfNeeded
private function includeFormatIfNeeded(&$path, &$requirements) { if (true === $this->includeFormat) { $path .= '.{_format}'; if (!isset($requirements['_format']) && !empty($this->formats)) { $requirements['_format'] = implode('|', array_keys($this->formats)); ...
php
private function includeFormatIfNeeded(&$path, &$requirements) { if (true === $this->includeFormat) { $path .= '.{_format}'; if (!isset($requirements['_format']) && !empty($this->formats)) { $requirements['_format'] = implode('|', array_keys($this->formats)); ...
[ "private", "function", "includeFormatIfNeeded", "(", "&", "$", "path", ",", "&", "$", "requirements", ")", "{", "if", "(", "true", "===", "$", "this", "->", "includeFormat", ")", "{", "$", "path", ".=", "'.{_format}'", ";", "if", "(", "!", "isset", "("...
Include the format in the path and requirements if its enabled. @param string $path @param array $requirements
[ "Include", "the", "format", "in", "the", "path", "and", "requirements", "if", "its", "enabled", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L424-L433
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.isMethodReadable
private function isMethodReadable(\ReflectionMethod $method) { // if method starts with _ - skip if ('_' === substr($method->getName(), 0, 1)) { return false; } $hasNoRouteMethod = (bool) $this->readMethodAnnotation($method, 'NoRoute'); $hasNoRouteClass = (bool) ...
php
private function isMethodReadable(\ReflectionMethod $method) { // if method starts with _ - skip if ('_' === substr($method->getName(), 0, 1)) { return false; } $hasNoRouteMethod = (bool) $this->readMethodAnnotation($method, 'NoRoute'); $hasNoRouteClass = (bool) ...
[ "private", "function", "isMethodReadable", "(", "\\", "ReflectionMethod", "$", "method", ")", "{", "// if method starts with _ - skip", "if", "(", "'_'", "===", "substr", "(", "$", "method", "->", "getName", "(", ")", ",", "0", ",", "1", ")", ")", "{", "re...
Checks whether provided method is readable. @param \ReflectionMethod $method @return bool
[ "Checks", "whether", "provided", "method", "is", "readable", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L442-L462
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.getHttpMethodAndResourcesFromMethod
private function getHttpMethodAndResourcesFromMethod(\ReflectionMethod $method, $resource) { // if method doesn't match regex - skip if (!preg_match('/([a-z][_a-z0-9]+)(.*)Action/', $method->getName(), $matches)) { return false; } $httpMethod = strtolower($matches[1]); ...
php
private function getHttpMethodAndResourcesFromMethod(\ReflectionMethod $method, $resource) { // if method doesn't match regex - skip if (!preg_match('/([a-z][_a-z0-9]+)(.*)Action/', $method->getName(), $matches)) { return false; } $httpMethod = strtolower($matches[1]); ...
[ "private", "function", "getHttpMethodAndResourcesFromMethod", "(", "\\", "ReflectionMethod", "$", "method", ",", "$", "resource", ")", "{", "// if method doesn't match regex - skip", "if", "(", "!", "preg_match", "(", "'/([a-z][_a-z0-9]+)(.*)Action/'", ",", "$", "method",...
Returns HTTP method and resources list from method signature. @param \ReflectionMethod $method @param string[] $resource @return bool|array
[ "Returns", "HTTP", "method", "and", "resources", "list", "from", "method", "signature", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L472-L504
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.getMethodArguments
private function getMethodArguments(\ReflectionMethod $method) { // ignore all query params $params = $this->paramReader->getParamsFromMethod($method); // check if a parameter is coming from the request body $ignoreParameters = []; if (class_exists(ParamConverter::class)) { ...
php
private function getMethodArguments(\ReflectionMethod $method) { // ignore all query params $params = $this->paramReader->getParamsFromMethod($method); // check if a parameter is coming from the request body $ignoreParameters = []; if (class_exists(ParamConverter::class)) { ...
[ "private", "function", "getMethodArguments", "(", "\\", "ReflectionMethod", "$", "method", ")", "{", "// ignore all query params", "$", "params", "=", "$", "this", "->", "paramReader", "->", "getParamsFromMethod", "(", "$", "method", ")", ";", "// check if a paramet...
Returns readable arguments from method. @param \ReflectionMethod $method @return \ReflectionParameter[]
[ "Returns", "readable", "arguments", "from", "method", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L513-L562
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.generateResourceName
private function generateResourceName($resource) { if (false === $this->pluralize) { return $resource; } return $this->inflector->pluralize($resource); }
php
private function generateResourceName($resource) { if (false === $this->pluralize) { return $resource; } return $this->inflector->pluralize($resource); }
[ "private", "function", "generateResourceName", "(", "$", "resource", ")", "{", "if", "(", "false", "===", "$", "this", "->", "pluralize", ")", "{", "return", "$", "resource", ";", "}", "return", "$", "this", "->", "inflector", "->", "pluralize", "(", "$"...
Generates final resource name. @param string|bool $resource @return string
[ "Generates", "final", "resource", "name", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L571-L578
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.generateRouteName
private function generateRouteName(array $resources) { $routeName = ''; foreach ($resources as $resource) { if (null !== $resource) { $routeName .= '_'.basename($resource); } } return $routeName; }
php
private function generateRouteName(array $resources) { $routeName = ''; foreach ($resources as $resource) { if (null !== $resource) { $routeName .= '_'.basename($resource); } } return $routeName; }
[ "private", "function", "generateRouteName", "(", "array", "$", "resources", ")", "{", "$", "routeName", "=", "''", ";", "foreach", "(", "$", "resources", "as", "$", "resource", ")", "{", "if", "(", "null", "!==", "$", "resource", ")", "{", "$", "routeN...
Generates route name from resources list. @param string[] $resources @return string
[ "Generates", "route", "name", "from", "resources", "list", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L587-L597
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.generateUrlParts
private function generateUrlParts(array $resources, array $arguments, $httpMethod) { $urlParts = []; foreach ($resources as $i => $resource) { // if we already added all parent routes paths to URL & we have // prefix - add it if (!empty($this->routePrefix) && $i =...
php
private function generateUrlParts(array $resources, array $arguments, $httpMethod) { $urlParts = []; foreach ($resources as $i => $resource) { // if we already added all parent routes paths to URL & we have // prefix - add it if (!empty($this->routePrefix) && $i =...
[ "private", "function", "generateUrlParts", "(", "array", "$", "resources", ",", "array", "$", "arguments", ",", "$", "httpMethod", ")", "{", "$", "urlParts", "=", "[", "]", ";", "foreach", "(", "$", "resources", "as", "$", "i", "=>", "$", "resource", "...
Generates URL parts for route from resources list. @param string[] $resources @param \ReflectionParameter[] $arguments @param string $httpMethod @return array
[ "Generates", "URL", "parts", "for", "route", "from", "resources", "list", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L608-L641
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.getCustomHttpMethod
private function getCustomHttpMethod($httpMethod, array $resources, array $arguments) { if (in_array($httpMethod, $this->availableConventionalActions)) { // allow hypertext as the engine of application state // through conventional GET actions return 'get'; } ...
php
private function getCustomHttpMethod($httpMethod, array $resources, array $arguments) { if (in_array($httpMethod, $this->availableConventionalActions)) { // allow hypertext as the engine of application state // through conventional GET actions return 'get'; } ...
[ "private", "function", "getCustomHttpMethod", "(", "$", "httpMethod", ",", "array", "$", "resources", ",", "array", "$", "arguments", ")", "{", "if", "(", "in_array", "(", "$", "httpMethod", ",", "$", "this", "->", "availableConventionalActions", ")", ")", "...
Returns custom HTTP method for provided list of resources, arguments, method. @param string $httpMethod current HTTP method @param string[] $resources resources list @param \ReflectionParameter[] $arguments list of method arguments @return string
[ "Returns", "custom", "HTTP", "method", "for", "provided", "list", "of", "resources", "arguments", "method", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L652-L667
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.readRouteAnnotation
private function readRouteAnnotation(\ReflectionMethod $reflectionMethod) { $annotations = []; if ($newAnnotations = $this->readMethodAnnotations($reflectionMethod, 'Route')) { $annotations = array_merge($annotations, $newAnnotations); } return $annotations; }
php
private function readRouteAnnotation(\ReflectionMethod $reflectionMethod) { $annotations = []; if ($newAnnotations = $this->readMethodAnnotations($reflectionMethod, 'Route')) { $annotations = array_merge($annotations, $newAnnotations); } return $annotations; }
[ "private", "function", "readRouteAnnotation", "(", "\\", "ReflectionMethod", "$", "reflectionMethod", ")", "{", "$", "annotations", "=", "[", "]", ";", "if", "(", "$", "newAnnotations", "=", "$", "this", "->", "readMethodAnnotations", "(", "$", "reflectionMethod...
Returns first route annotation for method. @param \ReflectionMethod $reflectionMethod @return RouteAnnotation[]
[ "Returns", "first", "route", "annotation", "for", "method", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L676-L685
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.readClassAnnotation
private function readClassAnnotation(\ReflectionClass $reflectionClass, $annotationName) { $annotationClass = "FOS\\RestBundle\\Controller\\Annotations\\$annotationName"; if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, $annotationClass)) { return $annotat...
php
private function readClassAnnotation(\ReflectionClass $reflectionClass, $annotationName) { $annotationClass = "FOS\\RestBundle\\Controller\\Annotations\\$annotationName"; if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, $annotationClass)) { return $annotat...
[ "private", "function", "readClassAnnotation", "(", "\\", "ReflectionClass", "$", "reflectionClass", ",", "$", "annotationName", ")", "{", "$", "annotationClass", "=", "\"FOS\\\\RestBundle\\\\Controller\\\\Annotations\\\\$annotationName\"", ";", "if", "(", "$", "annotation",...
Reads class annotations. @param \ReflectionClass $reflectionClass @param string $annotationName @return RouteAnnotation|null
[ "Reads", "class", "annotations", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L695-L702
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.readMethodAnnotation
private function readMethodAnnotation(\ReflectionMethod $reflectionMethod, $annotationName) { $annotationClass = "FOS\\RestBundle\\Controller\\Annotations\\$annotationName"; if ($annotation = $this->annotationReader->getMethodAnnotation($reflectionMethod, $annotationClass)) { return $an...
php
private function readMethodAnnotation(\ReflectionMethod $reflectionMethod, $annotationName) { $annotationClass = "FOS\\RestBundle\\Controller\\Annotations\\$annotationName"; if ($annotation = $this->annotationReader->getMethodAnnotation($reflectionMethod, $annotationClass)) { return $an...
[ "private", "function", "readMethodAnnotation", "(", "\\", "ReflectionMethod", "$", "reflectionMethod", ",", "$", "annotationName", ")", "{", "$", "annotationClass", "=", "\"FOS\\\\RestBundle\\\\Controller\\\\Annotations\\\\$annotationName\"", ";", "if", "(", "$", "annotatio...
Reads method annotations. @param \ReflectionMethod $reflectionMethod @param string $annotationName @return RouteAnnotation|null
[ "Reads", "method", "annotations", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L712-L719
FriendsOfSymfony/FOSRestBundle
Routing/Loader/Reader/RestActionReader.php
RestActionReader.readMethodAnnotations
private function readMethodAnnotations(\ReflectionMethod $reflectionMethod, $annotationName) { $annotations = []; $annotationClass = "FOS\\RestBundle\\Controller\\Annotations\\$annotationName"; if ($annotations_new = $this->annotationReader->getMethodAnnotations($reflectionMethod)) { ...
php
private function readMethodAnnotations(\ReflectionMethod $reflectionMethod, $annotationName) { $annotations = []; $annotationClass = "FOS\\RestBundle\\Controller\\Annotations\\$annotationName"; if ($annotations_new = $this->annotationReader->getMethodAnnotations($reflectionMethod)) { ...
[ "private", "function", "readMethodAnnotations", "(", "\\", "ReflectionMethod", "$", "reflectionMethod", ",", "$", "annotationName", ")", "{", "$", "annotations", "=", "[", "]", ";", "$", "annotationClass", "=", "\"FOS\\\\RestBundle\\\\Controller\\\\Annotations\\\\$annotat...
Reads method annotations. @param \ReflectionMethod $reflectionMethod @param string $annotationName @return RouteAnnotation[]
[ "Reads", "method", "annotations", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/Reader/RestActionReader.php#L729-L743
FriendsOfSymfony/FOSRestBundle
Request/ParamReader.php
ParamReader.read
public function read(\ReflectionClass $reflection, $method) { if (!$reflection->hasMethod($method)) { throw new \InvalidArgumentException(sprintf("Class '%s' has no method '%s'.", $reflection->getName(), $method)); } $methodParams = $this->getParamsFromMethod($reflection->getMet...
php
public function read(\ReflectionClass $reflection, $method) { if (!$reflection->hasMethod($method)) { throw new \InvalidArgumentException(sprintf("Class '%s' has no method '%s'.", $reflection->getName(), $method)); } $methodParams = $this->getParamsFromMethod($reflection->getMet...
[ "public", "function", "read", "(", "\\", "ReflectionClass", "$", "reflection", ",", "$", "method", ")", "{", "if", "(", "!", "$", "reflection", "->", "hasMethod", "(", "$", "method", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/ParamReader.php#L41-L51
FriendsOfSymfony/FOSRestBundle
Request/ParamReader.php
ParamReader.getParamsFromMethod
public function getParamsFromMethod(\ReflectionMethod $method) { $annotations = $this->annotationReader->getMethodAnnotations($method); return $this->getParamsFromAnnotationArray($annotations); }
php
public function getParamsFromMethod(\ReflectionMethod $method) { $annotations = $this->annotationReader->getMethodAnnotations($method); return $this->getParamsFromAnnotationArray($annotations); }
[ "public", "function", "getParamsFromMethod", "(", "\\", "ReflectionMethod", "$", "method", ")", "{", "$", "annotations", "=", "$", "this", "->", "annotationReader", "->", "getMethodAnnotations", "(", "$", "method", ")", ";", "return", "$", "this", "->", "getPa...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/ParamReader.php#L56-L61
FriendsOfSymfony/FOSRestBundle
Request/ParamReader.php
ParamReader.getParamsFromAnnotationArray
private function getParamsFromAnnotationArray(array $annotations) { $params = array(); foreach ($annotations as $annotation) { if ($annotation instanceof ParamInterface) { $params[$annotation->getName()] = $annotation; } } return $params; ...
php
private function getParamsFromAnnotationArray(array $annotations) { $params = array(); foreach ($annotations as $annotation) { if ($annotation instanceof ParamInterface) { $params[$annotation->getName()] = $annotation; } } return $params; ...
[ "private", "function", "getParamsFromAnnotationArray", "(", "array", "$", "annotations", ")", "{", "$", "params", "=", "array", "(", ")", ";", "foreach", "(", "$", "annotations", "as", "$", "annotation", ")", "{", "if", "(", "$", "annotation", "instanceof", ...
Fetches parameters from provided annotation array (fetched from annotationReader). @param array $annotations @return ParamInterface[]
[ "Fetches", "parameters", "from", "provided", "annotation", "array", "(", "fetched", "from", "annotationReader", ")", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/ParamReader.php#L80-L90
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestYamlCollectionLoader.php
RestYamlCollectionLoader.load
public function load($file, $type = null) { $path = $this->locator->locate($file); try { $config = Yaml::parse(file_get_contents($path)); } catch (ParseException $e) { throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0...
php
public function load($file, $type = null) { $path = $this->locator->locate($file); try { $config = Yaml::parse(file_get_contents($path)); } catch (ParseException $e) { throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0...
[ "public", "function", "load", "(", "$", "file", ",", "$", "type", "=", "null", ")", "{", "$", "path", "=", "$", "this", "->", "locator", "->", "locate", "(", "$", "file", ")", ";", "try", "{", "$", "config", "=", "Yaml", "::", "parse", "(", "fi...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestYamlCollectionLoader.php#L60-L163
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestYamlCollectionLoader.php
RestYamlCollectionLoader.addParentNamePrefix
public function addParentNamePrefix(RouteCollection $collection, $namePrefix) { if (!isset($namePrefix) || '' === ($namePrefix = trim($namePrefix))) { return $collection; } $iterator = $collection->getIterator(); foreach ($iterator as $key1 => $route1) { $co...
php
public function addParentNamePrefix(RouteCollection $collection, $namePrefix) { if (!isset($namePrefix) || '' === ($namePrefix = trim($namePrefix))) { return $collection; } $iterator = $collection->getIterator(); foreach ($iterator as $key1 => $route1) { $co...
[ "public", "function", "addParentNamePrefix", "(", "RouteCollection", "$", "collection", ",", "$", "namePrefix", ")", "{", "if", "(", "!", "isset", "(", "$", "namePrefix", ")", "||", "''", "===", "(", "$", "namePrefix", "=", "trim", "(", "$", "namePrefix", ...
Adds a name prefix to the route name of all collection routes. @param RouteCollection $collection Route collection @param array $namePrefix NamePrefix to add in each route name of the route collection @return RouteCollection
[ "Adds", "a", "name", "prefix", "to", "the", "route", "name", "of", "all", "collection", "routes", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestYamlCollectionLoader.php#L182-L196
FriendsOfSymfony/FOSRestBundle
Request/RequestBodyParamConverter.php
RequestBodyParamConverter.apply
public function apply(Request $request, ParamConverter $configuration) { $options = (array) $configuration->getOptions(); if (isset($options['deserializationContext']) && is_array($options['deserializationContext'])) { $arrayContext = array_merge($this->context, $options['deserializatio...
php
public function apply(Request $request, ParamConverter $configuration) { $options = (array) $configuration->getOptions(); if (isset($options['deserializationContext']) && is_array($options['deserializationContext'])) { $arrayContext = array_merge($this->context, $options['deserializatio...
[ "public", "function", "apply", "(", "Request", "$", "request", ",", "ParamConverter", "$", "configuration", ")", "{", "$", "options", "=", "(", "array", ")", "$", "configuration", "->", "getOptions", "(", ")", ";", "if", "(", "isset", "(", "$", "options"...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/RequestBodyParamConverter.php#L80-L120
FriendsOfSymfony/FOSRestBundle
Request/RequestBodyParamConverter.php
RequestBodyParamConverter.getValidatorOptions
private function getValidatorOptions(array $options) { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'groups' => null, 'traverse' => false, 'deep' => false, ]); return $resolver->resolve(isset($options['validator']) ? $options['valid...
php
private function getValidatorOptions(array $options) { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'groups' => null, 'traverse' => false, 'deep' => false, ]); return $resolver->resolve(isset($options['validator']) ? $options['valid...
[ "private", "function", "getValidatorOptions", "(", "array", "$", "options", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefaults", "(", "[", "'groups'", "=>", "null", ",", "'traverse'", "=>", "false", ...
@param array $options @return array
[ "@param", "array", "$options" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Request/RequestBodyParamConverter.php#L171-L181
FriendsOfSymfony/FOSRestBundle
EventListener/ExceptionListener.php
ExceptionListener.onKernelException
public function onKernelException(GetResponseForExceptionEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } parent::onKernelException($event); }
php
public function onKernelException(GetResponseForExceptionEvent $event) { $request = $event->getRequest(); if (!$request->attributes->get(FOSRestBundle::ZONE_ATTRIBUTE, true)) { return; } parent::onKernelException($event); }
[ "public", "function", "onKernelException", "(", "GetResponseForExceptionEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "request", "->", "attributes", "->", "get", "(", "FOSRestBundle...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/ExceptionListener.php#L33-L42
FriendsOfSymfony/FOSRestBundle
EventListener/ExceptionListener.php
ExceptionListener.duplicateRequest
protected function duplicateRequest(\Exception $exception, Request $request) { $attributes = array( '_controller' => $this->controller, 'exception' => $exception, 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, ); $request...
php
protected function duplicateRequest(\Exception $exception, Request $request) { $attributes = array( '_controller' => $this->controller, 'exception' => $exception, 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, ); $request...
[ "protected", "function", "duplicateRequest", "(", "\\", "Exception", "$", "exception", ",", "Request", "$", "request", ")", "{", "$", "attributes", "=", "array", "(", "'_controller'", "=>", "$", "this", "->", "controller", ",", "'exception'", "=>", "$", "exc...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/EventListener/ExceptionListener.php#L57-L68
FriendsOfSymfony/FOSRestBundle
Serializer/Normalizer/ExceptionHandler.php
ExceptionHandler.serializeToJson
public function serializeToJson( JsonSerializationVisitor $visitor, \Exception $exception, array $type, Context $context ) { $data = $this->convertToArray($exception, $context); return $visitor->visitArray($data, $type, $context); }
php
public function serializeToJson( JsonSerializationVisitor $visitor, \Exception $exception, array $type, Context $context ) { $data = $this->convertToArray($exception, $context); return $visitor->visitArray($data, $type, $context); }
[ "public", "function", "serializeToJson", "(", "JsonSerializationVisitor", "$", "visitor", ",", "\\", "Exception", "$", "exception", ",", "array", "$", "type", ",", "Context", "$", "context", ")", "{", "$", "data", "=", "$", "this", "->", "convertToArray", "(...
@param JsonSerializationVisitor $visitor @param \Exception $exception @param array $type @param Context $context @return array
[ "@param", "JsonSerializationVisitor", "$visitor", "@param", "\\", "Exception", "$exception", "@param", "array", "$type", "@param", "Context", "$context" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/Normalizer/ExceptionHandler.php#L51-L60
FriendsOfSymfony/FOSRestBundle
Serializer/Normalizer/ExceptionHandler.php
ExceptionHandler.convertToArray
protected function convertToArray(\Exception $exception, Context $context) { $data = []; if ($context->hasAttribute('template_data')) { $templateData = $context->getAttribute('template_data'); if (array_key_exists('status_code', $templateData)) { $data['code'...
php
protected function convertToArray(\Exception $exception, Context $context) { $data = []; if ($context->hasAttribute('template_data')) { $templateData = $context->getAttribute('template_data'); if (array_key_exists('status_code', $templateData)) { $data['code'...
[ "protected", "function", "convertToArray", "(", "\\", "Exception", "$", "exception", ",", "Context", "$", "context", ")", "{", "$", "data", "=", "[", "]", ";", "if", "(", "$", "context", "->", "hasAttribute", "(", "'template_data'", ")", ")", "{", "$", ...
@param \Exception $exception @param Context $context @return array
[ "@param", "\\", "Exception", "$exception", "@param", "Context", "$context" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Serializer/Normalizer/ExceptionHandler.php#L102-L116
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestRouteProcessor.php
RestRouteProcessor.importResource
public function importResource( LoaderInterface $loader, $resource, array $parents = [], $routePrefix = null, $namePrefix = null, $type = null, $currentDir = null ) { $loader = $loader->resolve($resource, $type); if ($loader instanceof FileLoa...
php
public function importResource( LoaderInterface $loader, $resource, array $parents = [], $routePrefix = null, $namePrefix = null, $type = null, $currentDir = null ) { $loader = $loader->resolve($resource, $type); if ($loader instanceof FileLoa...
[ "public", "function", "importResource", "(", "LoaderInterface", "$", "loader", ",", "$", "resource", ",", "array", "$", "parents", "=", "[", "]", ",", "$", "routePrefix", "=", "null", ",", "$", "namePrefix", "=", "null", ",", "$", "type", "=", "null", ...
Import & return routes collection from a resource. @param LoaderInterface $loader The Loader @param mixed $resource A Resource @param array $parents Array of parent resources names @param string $routePrefix Current routes prefix @param string $namePrefix Routes names...
[ "Import", "&", "return", "routes", "collection", "from", "a", "resource", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestRouteProcessor.php#L39-L59
FriendsOfSymfony/FOSRestBundle
Response/AllowedMethodsLoader/AllowedMethodsRouterLoader.php
AllowedMethodsRouterLoader.getAllowedMethods
public function getAllowedMethods() { if (!$this->cache->isFresh()) { $this->warmUp(null); } return require $this->cache->getPath(); }
php
public function getAllowedMethods() { if (!$this->cache->isFresh()) { $this->warmUp(null); } return require $this->cache->getPath(); }
[ "public", "function", "getAllowedMethods", "(", ")", "{", "if", "(", "!", "$", "this", "->", "cache", "->", "isFresh", "(", ")", ")", "{", "$", "this", "->", "warmUp", "(", "null", ")", ";", "}", "return", "require", "$", "this", "->", "cache", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Response/AllowedMethodsLoader/AllowedMethodsRouterLoader.php#L45-L52
FriendsOfSymfony/FOSRestBundle
Response/AllowedMethodsLoader/AllowedMethodsRouterLoader.php
AllowedMethodsRouterLoader.warmUp
public function warmUp($cacheDir) { $processedRoutes = []; $routeCollection = $this->router->getRouteCollection(); foreach ($routeCollection->all() as $name => $route) { if (!isset($processedRoutes[$route->getPath()])) { $processedRoutes[$route->getPath()] = [ ...
php
public function warmUp($cacheDir) { $processedRoutes = []; $routeCollection = $this->router->getRouteCollection(); foreach ($routeCollection->all() as $name => $route) { if (!isset($processedRoutes[$route->getPath()])) { $processedRoutes[$route->getPath()] = [ ...
[ "public", "function", "warmUp", "(", "$", "cacheDir", ")", "{", "$", "processedRoutes", "=", "[", "]", ";", "$", "routeCollection", "=", "$", "this", "->", "router", "->", "getRouteCollection", "(", ")", ";", "foreach", "(", "$", "routeCollection", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Response/AllowedMethodsLoader/AllowedMethodsRouterLoader.php#L65-L100
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestRouteLoader.php
RestRouteLoader.load
public function load($controller, $type = null) { list($prefix, $class) = $this->getControllerLocator($controller); $collection = $this->controllerReader->read(new \ReflectionClass($class)); $collection->prependRouteControllersWithPrefix($prefix); $collection->setDefaultFormat($this...
php
public function load($controller, $type = null) { list($prefix, $class) = $this->getControllerLocator($controller); $collection = $this->controllerReader->read(new \ReflectionClass($class)); $collection->prependRouteControllersWithPrefix($prefix); $collection->setDefaultFormat($this...
[ "public", "function", "load", "(", "$", "controller", ",", "$", "type", "=", "null", ")", "{", "list", "(", "$", "prefix", ",", "$", "class", ")", "=", "$", "this", "->", "getControllerLocator", "(", "$", "controller", ")", ";", "$", "collection", "=...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestRouteLoader.php#L71-L80
FriendsOfSymfony/FOSRestBundle
Routing/Loader/RestRouteLoader.php
RestRouteLoader.getControllerLocator
private function getControllerLocator($controller) { $class = null; $prefix = null; if (0 === strpos($controller, '@')) { $file = $this->locator->locate($controller); $controllerClass = ClassUtils::findClassInFile($file); if (false === $controllerClass) ...
php
private function getControllerLocator($controller) { $class = null; $prefix = null; if (0 === strpos($controller, '@')) { $file = $this->locator->locate($controller); $controllerClass = ClassUtils::findClassInFile($file); if (false === $controllerClass) ...
[ "private", "function", "getControllerLocator", "(", "$", "controller", ")", "{", "$", "class", "=", "null", ";", "$", "prefix", "=", "null", ";", "if", "(", "0", "===", "strpos", "(", "$", "controller", ",", "'@'", ")", ")", "{", "$", "file", "=", ...
Returns controller locator by it's id. @param string $controller @throws \InvalidArgumentException @return array
[ "Returns", "controller", "locator", "by", "it", "s", "id", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Routing/Loader/RestRouteLoader.php#L102-L159
FriendsOfSymfony/FOSRestBundle
Version/Resolver/QueryParameterVersionResolver.php
QueryParameterVersionResolver.resolve
public function resolve(Request $request) { if (!$request->query->has($this->parameterName)) { return false; } $parameter = $request->query->get($this->parameterName); return is_scalar($parameter) ? $parameter : strval($parameter); }
php
public function resolve(Request $request) { if (!$request->query->has($this->parameterName)) { return false; } $parameter = $request->query->get($this->parameterName); return is_scalar($parameter) ? $parameter : strval($parameter); }
[ "public", "function", "resolve", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "$", "request", "->", "query", "->", "has", "(", "$", "this", "->", "parameterName", ")", ")", "{", "return", "false", ";", "}", "$", "parameter", "=", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Version/Resolver/QueryParameterVersionResolver.php#L38-L47
FriendsOfSymfony/FOSRestBundle
Controller/FOSRestController.php
FOSRestController.getViewHandler
protected function getViewHandler() { if (!$this->viewhandler instanceof ViewHandlerInterface) { $this->viewhandler = $this->container->get('fos_rest.view_handler'); } return $this->viewhandler; }
php
protected function getViewHandler() { if (!$this->viewhandler instanceof ViewHandlerInterface) { $this->viewhandler = $this->container->get('fos_rest.view_handler'); } return $this->viewhandler; }
[ "protected", "function", "getViewHandler", "(", ")", "{", "if", "(", "!", "$", "this", "->", "viewhandler", "instanceof", "ViewHandlerInterface", ")", "{", "$", "this", "->", "viewhandler", "=", "$", "this", "->", "container", "->", "get", "(", "'fos_rest.vi...
Get the ViewHandler. @return ViewHandlerInterface
[ "Get", "the", "ViewHandler", "." ]
train
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/38046e93a69c3d4dbe650e5def36ff9fd35fcaaf/Controller/FOSRestController.php#L33-L40
php-pds/skeleton
src/ComplianceValidator.php
ComplianceValidator.getFiles
public function getFiles($root = null) { $root = $root ?: __DIR__ . '/../../../../'; $root = realpath($root); if ($this->files == null) { $files = scandir($root); foreach ($files as $i => $file) { if (is_dir("$root/$file")) { $file...
php
public function getFiles($root = null) { $root = $root ?: __DIR__ . '/../../../../'; $root = realpath($root); if ($this->files == null) { $files = scandir($root); foreach ($files as $i => $file) { if (is_dir("$root/$file")) { $file...
[ "public", "function", "getFiles", "(", "$", "root", "=", "null", ")", "{", "$", "root", "=", "$", "root", "?", ":", "__DIR__", ".", "'/../../../../'", ";", "$", "root", "=", "realpath", "(", "$", "root", ")", ";", "if", "(", "$", "this", "->", "f...
Get list of files and directories previously set, or generate from parent project.
[ "Get", "list", "of", "files", "and", "directories", "previously", "set", "or", "generate", "from", "parent", "project", "." ]
train
https://github.com/php-pds/skeleton/blob/75afe0c74131620b18239174bc67d6229bea273a/src/ComplianceValidator.php#L66-L82
chrisboulton/php-resque
lib/Resque/Failure.php
Resque_Failure.create
public static function create($payload, Exception $exception, Resque_Worker $worker, $queue) { $backend = self::getBackend(); new $backend($payload, $exception, $worker, $queue); }
php
public static function create($payload, Exception $exception, Resque_Worker $worker, $queue) { $backend = self::getBackend(); new $backend($payload, $exception, $worker, $queue); }
[ "public", "static", "function", "create", "(", "$", "payload", ",", "Exception", "$", "exception", ",", "Resque_Worker", "$", "worker", ",", "$", "queue", ")", "{", "$", "backend", "=", "self", "::", "getBackend", "(", ")", ";", "new", "$", "backend", ...
Create a new failed job on the backend. @param object $payload The contents of the job that has just failed. @param \Exception $exception The exception generated when the job failed to run. @param \Resque_Worker $worker Instance of Resque_Worker that was running this job when it failed. @param string $queue ...
[ "Create", "a", "new", "failed", "job", "on", "the", "backend", "." ]
train
https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Failure.php#L25-L29
chrisboulton/php-resque
lib/Resque/Log.php
Resque_Log.log
public function log($level, $message, array $context = array()) { if ($this->verbose) { fwrite( STDOUT, '[' . $level . '] [' . strftime('%T %Y-%m-%d') . '] ' . $this->interpolate($message, $context) . PHP_EOL ); return; } if (!($level === Psr\Log\LogLevel::INFO || $level === Psr\Log\LogLevel::D...
php
public function log($level, $message, array $context = array()) { if ($this->verbose) { fwrite( STDOUT, '[' . $level . '] [' . strftime('%T %Y-%m-%d') . '] ' . $this->interpolate($message, $context) . PHP_EOL ); return; } if (!($level === Psr\Log\LogLevel::INFO || $level === Psr\Log\LogLevel::D...
[ "public", "function", "log", "(", "$", "level", ",", "$", "message", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "if", "(", "$", "this", "->", "verbose", ")", "{", "fwrite", "(", "STDOUT", ",", "'['", ".", "$", "level", ".", ...
Logs with an arbitrary level. @param mixed $level PSR-3 log level constant, or equivalent string @param string $message Message to log, may contain a { placeholder } @param array $context Variables to replace { placeholder } @return null
[ "Logs", "with", "an", "arbitrary", "level", "." ]
train
https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Log.php#L25-L41