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
neos/flow-development-collection
Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
ProxyClassBuilder.addAdvicedMethodsToInterceptedMethods
protected function addAdvicedMethodsToInterceptedMethods(array &$interceptedMethods, array $methods, string $targetClassName, array &$aspectContainers): void { $pointcutQueryIdentifier = 0; foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } foreach ($aspectContainer->getAdvisors() as $advisor) { $pointcut = $advisor->getPointcut(); foreach ($methods as $method) { list($methodDeclaringClassName, $methodName) = $method; if ($this->reflectionService->isMethodStatic($targetClassName, $methodName)) { continue; } if ($pointcut->matches($targetClassName, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier)) { $advice = $advisor->getAdvice(); $interceptedMethods[$methodName]['groupedAdvices'][get_class($advice)][] = [ 'advice' => $advice, 'runtimeEvaluationsClosureCode' => $pointcut->getRuntimeEvaluationsClosureCode() ]; $interceptedMethods[$methodName]['declaringClassName'] = $methodDeclaringClassName; } $pointcutQueryIdentifier++; } } } }
php
protected function addAdvicedMethodsToInterceptedMethods(array &$interceptedMethods, array $methods, string $targetClassName, array &$aspectContainers): void { $pointcutQueryIdentifier = 0; foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } foreach ($aspectContainer->getAdvisors() as $advisor) { $pointcut = $advisor->getPointcut(); foreach ($methods as $method) { list($methodDeclaringClassName, $methodName) = $method; if ($this->reflectionService->isMethodStatic($targetClassName, $methodName)) { continue; } if ($pointcut->matches($targetClassName, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier)) { $advice = $advisor->getAdvice(); $interceptedMethods[$methodName]['groupedAdvices'][get_class($advice)][] = [ 'advice' => $advice, 'runtimeEvaluationsClosureCode' => $pointcut->getRuntimeEvaluationsClosureCode() ]; $interceptedMethods[$methodName]['declaringClassName'] = $methodDeclaringClassName; } $pointcutQueryIdentifier++; } } } }
[ "protected", "function", "addAdvicedMethodsToInterceptedMethods", "(", "array", "&", "$", "interceptedMethods", ",", "array", "$", "methods", ",", "string", "$", "targetClassName", ",", "array", "&", "$", "aspectContainers", ")", ":", "void", "{", "$", "pointcutQu...
Traverses all aspect containers, their aspects and their advisors and adds the methods and their advices to the (usually empty) array of intercepted methods. @param array &$interceptedMethods An array (empty or not) which contains the names of the intercepted methods and additional information @param array $methods An array of class and method names which are matched against the pointcut (class name = name of the class or interface the method was declared) @param string $targetClassName Name of the class the pointcut should match with @param array &$aspectContainers All aspects to take into consideration @return void
[ "Traverses", "all", "aspect", "containers", "their", "aspects", "and", "their", "advisors", "and", "adds", "the", "methods", "and", "their", "advices", "to", "the", "(", "usually", "empty", ")", "array", "of", "intercepted", "methods", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php#L641-L670
neos/flow-development-collection
Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
ProxyClassBuilder.addIntroducedMethodsToInterceptedMethods
protected function addIntroducedMethodsToInterceptedMethods(array &$interceptedMethods, array $methodsFromIntroducedInterfaces): void { foreach ($methodsFromIntroducedInterfaces as $interfaceAndMethodName) { list($interfaceName, $methodName) = $interfaceAndMethodName; if (!isset($interceptedMethods[$methodName])) { $interceptedMethods[$methodName]['groupedAdvices'] = []; $interceptedMethods[$methodName]['declaringClassName'] = $interfaceName; } } }
php
protected function addIntroducedMethodsToInterceptedMethods(array &$interceptedMethods, array $methodsFromIntroducedInterfaces): void { foreach ($methodsFromIntroducedInterfaces as $interfaceAndMethodName) { list($interfaceName, $methodName) = $interfaceAndMethodName; if (!isset($interceptedMethods[$methodName])) { $interceptedMethods[$methodName]['groupedAdvices'] = []; $interceptedMethods[$methodName]['declaringClassName'] = $interfaceName; } } }
[ "protected", "function", "addIntroducedMethodsToInterceptedMethods", "(", "array", "&", "$", "interceptedMethods", ",", "array", "$", "methodsFromIntroducedInterfaces", ")", ":", "void", "{", "foreach", "(", "$", "methodsFromIntroducedInterfaces", "as", "$", "interfaceAnd...
Traverses all methods which were introduced by interfaces and adds them to the intercepted methods array if they didn't exist already. @param array &$interceptedMethods An array (empty or not) which contains the names of the intercepted methods and additional information @param array $methodsFromIntroducedInterfaces An array of class and method names from introduced interfaces @return void
[ "Traverses", "all", "methods", "which", "were", "introduced", "by", "interfaces", "and", "adds", "them", "to", "the", "intercepted", "methods", "array", "if", "they", "didn", "t", "exist", "already", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php#L680-L689
neos/flow-development-collection
Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
ProxyClassBuilder.getMatchingInterfaceIntroductions
protected function getMatchingInterfaceIntroductions(array &$aspectContainers, string $targetClassName): array { $introductions = []; foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } foreach ($aspectContainer->getInterfaceIntroductions() as $introduction) { $pointcut = $introduction->getPointcut(); if ($pointcut->matches($targetClassName, null, null, Algorithms::generateRandomString(13))) { $introductions[] = $introduction; } } } return $introductions; }
php
protected function getMatchingInterfaceIntroductions(array &$aspectContainers, string $targetClassName): array { $introductions = []; foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } foreach ($aspectContainer->getInterfaceIntroductions() as $introduction) { $pointcut = $introduction->getPointcut(); if ($pointcut->matches($targetClassName, null, null, Algorithms::generateRandomString(13))) { $introductions[] = $introduction; } } } return $introductions; }
[ "protected", "function", "getMatchingInterfaceIntroductions", "(", "array", "&", "$", "aspectContainers", ",", "string", "$", "targetClassName", ")", ":", "array", "{", "$", "introductions", "=", "[", "]", ";", "foreach", "(", "$", "aspectContainers", "as", "$",...
Traverses all aspect containers and returns an array of interface introductions which match the target class. @param array &$aspectContainers All aspects to take into consideration @param string $targetClassName Name of the class the pointcut should match with @return array array of interface names
[ "Traverses", "all", "aspect", "containers", "and", "returns", "an", "array", "of", "interface", "introductions", "which", "match", "the", "target", "class", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php#L699-L714
neos/flow-development-collection
Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
ProxyClassBuilder.getMatchingPropertyIntroductions
protected function getMatchingPropertyIntroductions(array &$aspectContainers, string $targetClassName): array { $introductions = []; foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } foreach ($aspectContainer->getPropertyIntroductions() as $introduction) { $pointcut = $introduction->getPointcut(); if ($pointcut->matches($targetClassName, null, null, Algorithms::generateRandomString(13))) { $introductions[] = $introduction; } } } return $introductions; }
php
protected function getMatchingPropertyIntroductions(array &$aspectContainers, string $targetClassName): array { $introductions = []; foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } foreach ($aspectContainer->getPropertyIntroductions() as $introduction) { $pointcut = $introduction->getPointcut(); if ($pointcut->matches($targetClassName, null, null, Algorithms::generateRandomString(13))) { $introductions[] = $introduction; } } } return $introductions; }
[ "protected", "function", "getMatchingPropertyIntroductions", "(", "array", "&", "$", "aspectContainers", ",", "string", "$", "targetClassName", ")", ":", "array", "{", "$", "introductions", "=", "[", "]", ";", "foreach", "(", "$", "aspectContainers", "as", "$", ...
Traverses all aspect containers and returns an array of property introductions which match the target class. @param array &$aspectContainers All aspects to take into consideration @param string $targetClassName Name of the class the pointcut should match with @return array|PropertyIntroduction[] array of property introductions
[ "Traverses", "all", "aspect", "containers", "and", "returns", "an", "array", "of", "property", "introductions", "which", "match", "the", "target", "class", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php#L724-L739
neos/flow-development-collection
Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
ProxyClassBuilder.getMatchingTraitNamesFromIntroductions
protected function getMatchingTraitNamesFromIntroductions(array &$aspectContainers, string $targetClassName): array { $introductions = []; /** @var AspectContainer $aspectContainer */ foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } /** @var TraitIntroduction $introduction */ foreach ($aspectContainer->getTraitIntroductions() as $introduction) { $pointcut = $introduction->getPointcut(); if ($pointcut->matches($targetClassName, null, null, Algorithms::generateRandomString(13))) { $introductions[] = '\\' . $introduction->getTraitName(); } } } return $introductions; }
php
protected function getMatchingTraitNamesFromIntroductions(array &$aspectContainers, string $targetClassName): array { $introductions = []; /** @var AspectContainer $aspectContainer */ foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } /** @var TraitIntroduction $introduction */ foreach ($aspectContainer->getTraitIntroductions() as $introduction) { $pointcut = $introduction->getPointcut(); if ($pointcut->matches($targetClassName, null, null, Algorithms::generateRandomString(13))) { $introductions[] = '\\' . $introduction->getTraitName(); } } } return $introductions; }
[ "protected", "function", "getMatchingTraitNamesFromIntroductions", "(", "array", "&", "$", "aspectContainers", ",", "string", "$", "targetClassName", ")", ":", "array", "{", "$", "introductions", "=", "[", "]", ";", "/** @var AspectContainer $aspectContainer */", "forea...
Traverses all aspect containers and returns an array of trait introductions which match the target class. @param array &$aspectContainers All aspects to take into consideration @param string $targetClassName Name of the class the pointcut should match with @return array array of trait names
[ "Traverses", "all", "aspect", "containers", "and", "returns", "an", "array", "of", "trait", "introductions", "which", "match", "the", "target", "class", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php#L749-L767
neos/flow-development-collection
Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
ProxyClassBuilder.getInterfaceNamesFromIntroductions
protected function getInterfaceNamesFromIntroductions(array $interfaceIntroductions): array { $interfaceNames = []; foreach ($interfaceIntroductions as $introduction) { $interfaceNames[] = '\\' . $introduction->getInterfaceName(); } return $interfaceNames; }
php
protected function getInterfaceNamesFromIntroductions(array $interfaceIntroductions): array { $interfaceNames = []; foreach ($interfaceIntroductions as $introduction) { $interfaceNames[] = '\\' . $introduction->getInterfaceName(); } return $interfaceNames; }
[ "protected", "function", "getInterfaceNamesFromIntroductions", "(", "array", "$", "interfaceIntroductions", ")", ":", "array", "{", "$", "interfaceNames", "=", "[", "]", ";", "foreach", "(", "$", "interfaceIntroductions", "as", "$", "introduction", ")", "{", "$", ...
Returns an array of interface names introduced by the given introductions @param array $interfaceIntroductions An array of interface introductions @return array Array of interface names
[ "Returns", "an", "array", "of", "interface", "names", "introduced", "by", "the", "given", "introductions" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php#L775-L782
neos/flow-development-collection
Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
ProxyClassBuilder.getIntroducedMethodsFromInterfaceIntroductions
protected function getIntroducedMethodsFromInterfaceIntroductions(array $interfaceIntroductions): array { $methods = []; $methodsAndIntroductions = []; foreach ($interfaceIntroductions as $introduction) { $interfaceName = $introduction->getInterfaceName(); $methodNames = get_class_methods($interfaceName); if (is_array($methodNames)) { foreach ($methodNames as $newMethodName) { if (isset($methodsAndIntroductions[$newMethodName])) { throw new Aop\Exception('Method name conflict! Method "' . $newMethodName . '" introduced by "' . $introduction->getInterfaceName() . '" declared in aspect "' . $introduction->getDeclaringAspectClassName() . '" has already been introduced by "' . $methodsAndIntroductions[$newMethodName]->getInterfaceName() . '" declared in aspect "' . $methodsAndIntroductions[$newMethodName]->getDeclaringAspectClassName() . '".', 1173020942); } $methods[] = [$interfaceName, $newMethodName]; $methodsAndIntroductions[$newMethodName] = $introduction; } } } return $methods; }
php
protected function getIntroducedMethodsFromInterfaceIntroductions(array $interfaceIntroductions): array { $methods = []; $methodsAndIntroductions = []; foreach ($interfaceIntroductions as $introduction) { $interfaceName = $introduction->getInterfaceName(); $methodNames = get_class_methods($interfaceName); if (is_array($methodNames)) { foreach ($methodNames as $newMethodName) { if (isset($methodsAndIntroductions[$newMethodName])) { throw new Aop\Exception('Method name conflict! Method "' . $newMethodName . '" introduced by "' . $introduction->getInterfaceName() . '" declared in aspect "' . $introduction->getDeclaringAspectClassName() . '" has already been introduced by "' . $methodsAndIntroductions[$newMethodName]->getInterfaceName() . '" declared in aspect "' . $methodsAndIntroductions[$newMethodName]->getDeclaringAspectClassName() . '".', 1173020942); } $methods[] = [$interfaceName, $newMethodName]; $methodsAndIntroductions[$newMethodName] = $introduction; } } } return $methods; }
[ "protected", "function", "getIntroducedMethodsFromInterfaceIntroductions", "(", "array", "$", "interfaceIntroductions", ")", ":", "array", "{", "$", "methods", "=", "[", "]", ";", "$", "methodsAndIntroductions", "=", "[", "]", ";", "foreach", "(", "$", "interfaceI...
Returns all methods declared by the introduced interfaces @param array $interfaceIntroductions An array of Aop\InterfaceIntroduction @return array An array of method information (interface, method name) @throws Aop\Exception
[ "Returns", "all", "methods", "declared", "by", "the", "introduced", "interfaces" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php#L791-L809
neos/flow-development-collection
Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
ProxyClassBuilder.renderSourceHint
protected function renderSourceHint(string $aspectClassName, string $methodName, string $tagName): string { return sprintf('%s::%s (%s advice)', $aspectClassName, $methodName, $tagName); }
php
protected function renderSourceHint(string $aspectClassName, string $methodName, string $tagName): string { return sprintf('%s::%s (%s advice)', $aspectClassName, $methodName, $tagName); }
[ "protected", "function", "renderSourceHint", "(", "string", "$", "aspectClassName", ",", "string", "$", "methodName", ",", "string", "$", "tagName", ")", ":", "string", "{", "return", "sprintf", "(", "'%s::%s (%s advice)'", ",", "$", "aspectClassName", ",", "$",...
Renders a short message which gives a hint on where the currently parsed pointcut expression was defined. @param string $aspectClassName @param string $methodName @param string $tagName @return string
[ "Renders", "a", "short", "message", "which", "gives", "a", "hint", "on", "where", "the", "currently", "parsed", "pointcut", "expression", "was", "defined", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php#L819-L822
neos/flow-development-collection
Neos.FluidAdaptor/Classes/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php
NamespaceDetectionTemplateProcessor.preProcessSource
public function preProcessSource($templateSource) { $templateSource = $this->protectCDataSectionsFromParser($templateSource); $templateSource = $this->registerNamespacesFromTemplateSource($templateSource); $this->throwExceptionsForUnhandledNamespaces($templateSource); return $templateSource; }
php
public function preProcessSource($templateSource) { $templateSource = $this->protectCDataSectionsFromParser($templateSource); $templateSource = $this->registerNamespacesFromTemplateSource($templateSource); $this->throwExceptionsForUnhandledNamespaces($templateSource); return $templateSource; }
[ "public", "function", "preProcessSource", "(", "$", "templateSource", ")", "{", "$", "templateSource", "=", "$", "this", "->", "protectCDataSectionsFromParser", "(", "$", "templateSource", ")", ";", "$", "templateSource", "=", "$", "this", "->", "registerNamespace...
Pre-process the template source before it is returned to the TemplateParser or passed to the next TemplateProcessorInterface instance. @param string $templateSource @return string
[ "Pre", "-", "process", "the", "template", "source", "before", "it", "is", "returned", "to", "the", "TemplateParser", "or", "passed", "to", "the", "next", "TemplateProcessorInterface", "instance", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php#L58-L65
neos/flow-development-collection
Neos.FluidAdaptor/Classes/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php
NamespaceDetectionTemplateProcessor.protectCDataSectionsFromParser
public function protectCDataSectionsFromParser($templateSource) { $parts = preg_split('/(\<\!\[CDATA\[|\]\]\>)/', $templateSource, -1, PREG_SPLIT_DELIM_CAPTURE); $balance = 0; $content = ''; $resultingParts = []; foreach ($parts as $index => $part) { unset($parts[$index]); if ($balance === 0 && $part === '<![CDATA[') { $balance++; continue; } if ($balance === 0) { $resultingParts[] = $part; continue; } if ($balance === 1 && $part === ']]>') { $balance--; } if ($balance > 0 && $part === '<![CDATA[') { $balance++; } if ($balance > 0 && $part === ']]>') { $balance--; } if ($balance > 0) { $content .= $part; } if ($balance === 0 && $content !== '') { $resultingParts[] = '<f:format.base64Decode>' . base64_encode($content) . '</f:format.base64Decode>'; $content = ''; } } return implode('', $resultingParts); }
php
public function protectCDataSectionsFromParser($templateSource) { $parts = preg_split('/(\<\!\[CDATA\[|\]\]\>)/', $templateSource, -1, PREG_SPLIT_DELIM_CAPTURE); $balance = 0; $content = ''; $resultingParts = []; foreach ($parts as $index => $part) { unset($parts[$index]); if ($balance === 0 && $part === '<![CDATA[') { $balance++; continue; } if ($balance === 0) { $resultingParts[] = $part; continue; } if ($balance === 1 && $part === ']]>') { $balance--; } if ($balance > 0 && $part === '<![CDATA[') { $balance++; } if ($balance > 0 && $part === ']]>') { $balance--; } if ($balance > 0) { $content .= $part; } if ($balance === 0 && $content !== '') { $resultingParts[] = '<f:format.base64Decode>' . base64_encode($content) . '</f:format.base64Decode>'; $content = ''; } } return implode('', $resultingParts); }
[ "public", "function", "protectCDataSectionsFromParser", "(", "$", "templateSource", ")", "{", "$", "parts", "=", "preg_split", "(", "'/(\\<\\!\\[CDATA\\[|\\]\\]\\>)/'", ",", "$", "templateSource", ",", "-", "1", ",", "PREG_SPLIT_DELIM_CAPTURE", ")", ";", "$", "balan...
Encodes areas enclosed in CDATA to prevent further parsing by the Fluid engine. CDATA sections will appear as they are in the final rendered result. @param string $templateSource @return mixed
[ "Encodes", "areas", "enclosed", "in", "CDATA", "to", "prevent", "further", "parsing", "by", "the", "Fluid", "engine", ".", "CDATA", "sections", "will", "appear", "as", "they", "are", "in", "the", "final", "rendered", "result", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php#L74-L116
neos/flow-development-collection
Neos.FluidAdaptor/Classes/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php
NamespaceDetectionTemplateProcessor.throwExceptionsForUnhandledNamespaces
public function throwExceptionsForUnhandledNamespaces($templateSource) { $viewHelperResolver = $this->renderingContext->getViewHelperResolver(); $splitTemplate = preg_split(static::$EXTENDED_SPLIT_PATTERN_TEMPLATE_DYNAMICTAGS, $templateSource, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($splitTemplate as $templateElement) { if (preg_match(Patterns::$SCAN_PATTERN_TEMPLATE_VIEWHELPERTAG, $templateElement, $matchedVariables) > 0) { if (!$viewHelperResolver->isNamespaceValidOrIgnored($matchedVariables['NamespaceIdentifier'])) { throw new UnknownNamespaceException('Unkown Namespace: ' . htmlspecialchars($matchedVariables[0])); } continue; } elseif (preg_match(Patterns::$SCAN_PATTERN_TEMPLATE_CLOSINGVIEWHELPERTAG, $templateElement, $matchedVariables) > 0) { continue; } $sections = preg_split(Patterns::$SPLIT_PATTERN_SHORTHANDSYNTAX, $templateElement, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($sections as $section) { if (preg_match(Patterns::$SCAN_PATTERN_SHORTHANDSYNTAX_OBJECTACCESSORS, $section, $matchedVariables) > 0) { preg_match_all(Patterns::$SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER, $section, $shorthandViewHelpers, PREG_SET_ORDER); if (is_array($shorthandViewHelpers) === true) { foreach ($shorthandViewHelpers as $shorthandViewHelper) { if (!$viewHelperResolver->isNamespaceValidOrIgnored($shorthandViewHelper['NamespaceIdentifier'])) { throw new UnknownNamespaceException('Unkown Namespace: ' . $shorthandViewHelper['NamespaceIdentifier']); } } } } } } }
php
public function throwExceptionsForUnhandledNamespaces($templateSource) { $viewHelperResolver = $this->renderingContext->getViewHelperResolver(); $splitTemplate = preg_split(static::$EXTENDED_SPLIT_PATTERN_TEMPLATE_DYNAMICTAGS, $templateSource, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($splitTemplate as $templateElement) { if (preg_match(Patterns::$SCAN_PATTERN_TEMPLATE_VIEWHELPERTAG, $templateElement, $matchedVariables) > 0) { if (!$viewHelperResolver->isNamespaceValidOrIgnored($matchedVariables['NamespaceIdentifier'])) { throw new UnknownNamespaceException('Unkown Namespace: ' . htmlspecialchars($matchedVariables[0])); } continue; } elseif (preg_match(Patterns::$SCAN_PATTERN_TEMPLATE_CLOSINGVIEWHELPERTAG, $templateElement, $matchedVariables) > 0) { continue; } $sections = preg_split(Patterns::$SPLIT_PATTERN_SHORTHANDSYNTAX, $templateElement, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($sections as $section) { if (preg_match(Patterns::$SCAN_PATTERN_SHORTHANDSYNTAX_OBJECTACCESSORS, $section, $matchedVariables) > 0) { preg_match_all(Patterns::$SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER, $section, $shorthandViewHelpers, PREG_SET_ORDER); if (is_array($shorthandViewHelpers) === true) { foreach ($shorthandViewHelpers as $shorthandViewHelper) { if (!$viewHelperResolver->isNamespaceValidOrIgnored($shorthandViewHelper['NamespaceIdentifier'])) { throw new UnknownNamespaceException('Unkown Namespace: ' . $shorthandViewHelper['NamespaceIdentifier']); } } } } } } }
[ "public", "function", "throwExceptionsForUnhandledNamespaces", "(", "$", "templateSource", ")", "{", "$", "viewHelperResolver", "=", "$", "this", "->", "renderingContext", "->", "getViewHelperResolver", "(", ")", ";", "$", "splitTemplate", "=", "preg_split", "(", "s...
Throw an UnknownNamespaceException for any unknown and not ignored namespace inside the template string. @param string $templateSource @return void
[ "Throw", "an", "UnknownNamespaceException", "for", "any", "unknown", "and", "not", "ignored", "namespace", "inside", "the", "template", "string", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php#L125-L153
neos/flow-development-collection
Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php
FileSystemStorage.initializeObject
public function initializeObject() { if (!is_dir($this->path) && !is_link($this->path)) { throw new Exception('The directory "' . $this->path . '" which was configured as a resource storage does not exist.', 1361533189); } }
php
public function initializeObject() { if (!is_dir($this->path) && !is_link($this->path)) { throw new Exception('The directory "' . $this->path . '" which was configured as a resource storage does not exist.', 1361533189); } }
[ "public", "function", "initializeObject", "(", ")", "{", "if", "(", "!", "is_dir", "(", "$", "this", "->", "path", ")", "&&", "!", "is_link", "(", "$", "this", "->", "path", ")", ")", "{", "throw", "new", "Exception", "(", "'The directory \"'", ".", ...
Initializes this resource storage @return void @throws Exception If the storage directory does not exist
[ "Initializes", "this", "resource", "storage" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php#L87-L92
neos/flow-development-collection
Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php
FileSystemStorage.getStreamByResource
public function getStreamByResource(PersistentResource $resource) { $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1()); return (file_exists($pathAndFilename) ? fopen($pathAndFilename, 'rb') : false); }
php
public function getStreamByResource(PersistentResource $resource) { $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1()); return (file_exists($pathAndFilename) ? fopen($pathAndFilename, 'rb') : false); }
[ "public", "function", "getStreamByResource", "(", "PersistentResource", "$", "resource", ")", "{", "$", "pathAndFilename", "=", "$", "this", "->", "getStoragePathAndFilenameByHash", "(", "$", "resource", "->", "getSha1", "(", ")", ")", ";", "return", "(", "file_...
Returns a stream handle which can be used internally to open / copy the given resource stored in this storage. @param PersistentResource $resource The resource stored in this storage @return resource | boolean The resource stream or false if the stream could not be obtained
[ "Returns", "a", "stream", "handle", "which", "can", "be", "used", "internally", "to", "open", "/", "copy", "the", "given", "resource", "stored", "in", "this", "storage", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php#L111-L115
neos/flow-development-collection
Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php
FileSystemStorage.getStreamByResourcePath
public function getStreamByResourcePath($relativePath) { $pathAndFilename = $this->path . ltrim($relativePath, '/'); return (file_exists($pathAndFilename) ? fopen($pathAndFilename, 'r') : false); }
php
public function getStreamByResourcePath($relativePath) { $pathAndFilename = $this->path . ltrim($relativePath, '/'); return (file_exists($pathAndFilename) ? fopen($pathAndFilename, 'r') : false); }
[ "public", "function", "getStreamByResourcePath", "(", "$", "relativePath", ")", "{", "$", "pathAndFilename", "=", "$", "this", "->", "path", ".", "ltrim", "(", "$", "relativePath", ",", "'/'", ")", ";", "return", "(", "file_exists", "(", "$", "pathAndFilenam...
Returns a stream handle which can be used internally to open / copy the given resource stored in this storage. @param string $relativePath A path relative to the storage root, for example "MyFirstDirectory/SecondDirectory/Foo.css" @return resource | boolean A URI (for example the full path and filename) leading to the resource file or false if it does not exist
[ "Returns", "a", "stream", "handle", "which", "can", "be", "used", "internally", "to", "open", "/", "copy", "the", "given", "resource", "stored", "in", "this", "storage", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php#L124-L128
neos/flow-development-collection
Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php
FileSystemStorage.getObjects
public function getObjects(callable $callback = null) { foreach ($this->resourceManager->getCollectionsByStorage($this) as $collection) { yield $this->getObjectsByCollection($collection, $callback); } }
php
public function getObjects(callable $callback = null) { foreach ($this->resourceManager->getCollectionsByStorage($this) as $collection) { yield $this->getObjectsByCollection($collection, $callback); } }
[ "public", "function", "getObjects", "(", "callable", "$", "callback", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "resourceManager", "->", "getCollectionsByStorage", "(", "$", "this", ")", "as", "$", "collection", ")", "{", "yield", "$", "thi...
Retrieve all Objects stored in this storage. @param callable $callback Function called after each iteration @return \Generator<Object>
[ "Retrieve", "all", "Objects", "stored", "in", "this", "storage", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php#L136-L141
neos/flow-development-collection
Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php
FileSystemStorage.getObjectsByCollection
public function getObjectsByCollection(CollectionInterface $collection, callable $callback = null) { $iterator = $this->resourceRepository->findByCollectionNameIterator($collection->getName()); $iteration = 0; foreach ($this->resourceRepository->iterate($iterator, $callback) as $resource) { /** @var PersistentResource $resource */ $object = new StorageObject(); $object->setFilename($resource->getFilename()); $object->setSha1($resource->getSha1()); $object->setMd5($resource->getMd5()); $object->setFileSize($resource->getFileSize()); $object->setStream(function () use ($resource) { return $this->getStreamByResource($resource); }); yield $object; if (is_callable($callback)) { call_user_func($callback, $iteration, $object); } $iteration++; } }
php
public function getObjectsByCollection(CollectionInterface $collection, callable $callback = null) { $iterator = $this->resourceRepository->findByCollectionNameIterator($collection->getName()); $iteration = 0; foreach ($this->resourceRepository->iterate($iterator, $callback) as $resource) { /** @var PersistentResource $resource */ $object = new StorageObject(); $object->setFilename($resource->getFilename()); $object->setSha1($resource->getSha1()); $object->setMd5($resource->getMd5()); $object->setFileSize($resource->getFileSize()); $object->setStream(function () use ($resource) { return $this->getStreamByResource($resource); }); yield $object; if (is_callable($callback)) { call_user_func($callback, $iteration, $object); } $iteration++; } }
[ "public", "function", "getObjectsByCollection", "(", "CollectionInterface", "$", "collection", ",", "callable", "$", "callback", "=", "null", ")", "{", "$", "iterator", "=", "$", "this", "->", "resourceRepository", "->", "findByCollectionNameIterator", "(", "$", "...
Retrieve all Objects stored in this storage, filtered by the given collection name @param callable $callback Function called after each iteration @param CollectionInterface $collection @return \Generator<Object>
[ "Retrieve", "all", "Objects", "stored", "in", "this", "storage", "filtered", "by", "the", "given", "collection", "name" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ResourceManagement/Storage/FileSystemStorage.php#L150-L170
neos/flow-development-collection
Neos.Utility.OpcodeCache/Classes/OpcodeCacheHelper.php
OpcodeCacheHelper.initialize
protected static function initialize() { self::$clearCacheCallbacks = []; // Zend OpCache (built in by default since PHP 5.5) - http://php.net/manual/de/book.opcache.php if (extension_loaded('Zend OPcache') && ini_get('opcache.enable') === '1') { self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) { if ($absolutePathAndFilename !== null && function_exists('opcache_invalidate')) { opcache_invalidate($absolutePathAndFilename); } else { opcache_reset(); } }; } // WinCache - http://www.php.net/manual/de/book.wincache.php if (extension_loaded('wincache') && ini_get('wincache.ocenabled') === '1') { self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) { if ($absolutePathAndFilename !== null) { wincache_refresh_if_changed([$absolutePathAndFilename]); } else { // Refresh everything! wincache_refresh_if_changed(); } }; } // XCache - http://xcache.lighttpd.net/ // Supported in version >= 3.0.1 if (extension_loaded('xcache')) { self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) { // XCache can only be fully cleared. if (!ini_get('xcache.admin.enable_auth')) { xcache_clear_cache(XC_TYPE_PHP); } }; } }
php
protected static function initialize() { self::$clearCacheCallbacks = []; // Zend OpCache (built in by default since PHP 5.5) - http://php.net/manual/de/book.opcache.php if (extension_loaded('Zend OPcache') && ini_get('opcache.enable') === '1') { self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) { if ($absolutePathAndFilename !== null && function_exists('opcache_invalidate')) { opcache_invalidate($absolutePathAndFilename); } else { opcache_reset(); } }; } // WinCache - http://www.php.net/manual/de/book.wincache.php if (extension_loaded('wincache') && ini_get('wincache.ocenabled') === '1') { self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) { if ($absolutePathAndFilename !== null) { wincache_refresh_if_changed([$absolutePathAndFilename]); } else { // Refresh everything! wincache_refresh_if_changed(); } }; } // XCache - http://xcache.lighttpd.net/ // Supported in version >= 3.0.1 if (extension_loaded('xcache')) { self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) { // XCache can only be fully cleared. if (!ini_get('xcache.admin.enable_auth')) { xcache_clear_cache(XC_TYPE_PHP); } }; } }
[ "protected", "static", "function", "initialize", "(", ")", "{", "self", "::", "$", "clearCacheCallbacks", "=", "[", "]", ";", "// Zend OpCache (built in by default since PHP 5.5) - http://php.net/manual/de/book.opcache.php", "if", "(", "extension_loaded", "(", "'Zend OPcache'...
Initialize the ClearCache-Callbacks @return void
[ "Initialize", "the", "ClearCache", "-", "Callbacks" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.OpcodeCache/Classes/OpcodeCacheHelper.php#L34-L71
neos/flow-development-collection
Neos.Utility.OpcodeCache/Classes/OpcodeCacheHelper.php
OpcodeCacheHelper.clearAllActive
public static function clearAllActive(string $absolutePathAndFilename = null) { if (self::$clearCacheCallbacks === null) { self::initialize(); } foreach (self::$clearCacheCallbacks as $clearCacheCallback) { $clearCacheCallback($absolutePathAndFilename); } }
php
public static function clearAllActive(string $absolutePathAndFilename = null) { if (self::$clearCacheCallbacks === null) { self::initialize(); } foreach (self::$clearCacheCallbacks as $clearCacheCallback) { $clearCacheCallback($absolutePathAndFilename); } }
[ "public", "static", "function", "clearAllActive", "(", "string", "$", "absolutePathAndFilename", "=", "null", ")", "{", "if", "(", "self", "::", "$", "clearCacheCallbacks", "===", "null", ")", "{", "self", "::", "initialize", "(", ")", ";", "}", "foreach", ...
Clear a PHP file from all active cache files. Also supports to flush the cache completely, if called without parameter. @param string $absolutePathAndFilename Absolute path towards the PHP file to clear. @return void
[ "Clear", "a", "PHP", "file", "from", "all", "active", "cache", "files", ".", "Also", "supports", "to", "flush", "the", "cache", "completely", "if", "called", "without", "parameter", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Utility.OpcodeCache/Classes/OpcodeCacheHelper.php#L79-L87
neos/flow-development-collection
Neos.Eel/Classes/FlowQuery/Operations/Object/ChildrenOperation.php
ChildrenOperation.evaluate
public function evaluate(FlowQuery $flowQuery, array $arguments) { if (count($flowQuery->getContext()) === 0) { return; } if (!isset($arguments[0]) || empty($arguments[0])) { if ($flowQuery->peekOperationName() === 'filter') { $filterOperation = $flowQuery->popOperation(); if (count($filterOperation['arguments']) === 0 || empty($filterOperation['arguments'][0])) { throw new FizzleException('Filter() needs arguments if it follows an empty children(): children().filter()', 1332489382); } $selectorAndFilter = $filterOperation['arguments'][0]; } else { throw new FizzleException('children() needs at least a Property Name filter specified, or must be followed by filter().', 1332489399); } } else { $selectorAndFilter = $arguments[0]; } $parsedFilter = FizzleParser::parseFilterGroup($selectorAndFilter); if (count($parsedFilter['Filters']) === 0) { throw new FizzleException('filter needs to be specified in children()', 1332489416); } elseif (count($parsedFilter['Filters']) === 1) { $filter = $parsedFilter['Filters'][0]; if (isset($filter['PropertyNameFilter'])) { $this->evaluatePropertyNameFilter($flowQuery, $filter['PropertyNameFilter']); if (isset($filter['AttributeFilters'])) { foreach ($filter['AttributeFilters'] as $attributeFilter) { $flowQuery->pushOperation('filter', [$attributeFilter['text']]); } } } elseif (isset($filter['AttributeFilters'])) { throw new FizzleException('children() must have a property name filter and cannot only have an attribute filter.', 1332489432); } } else { throw new FizzleException('children() only supports a single filter group right now, i.e. nothing of the form "filter1, filter2"', 1332489489); } }
php
public function evaluate(FlowQuery $flowQuery, array $arguments) { if (count($flowQuery->getContext()) === 0) { return; } if (!isset($arguments[0]) || empty($arguments[0])) { if ($flowQuery->peekOperationName() === 'filter') { $filterOperation = $flowQuery->popOperation(); if (count($filterOperation['arguments']) === 0 || empty($filterOperation['arguments'][0])) { throw new FizzleException('Filter() needs arguments if it follows an empty children(): children().filter()', 1332489382); } $selectorAndFilter = $filterOperation['arguments'][0]; } else { throw new FizzleException('children() needs at least a Property Name filter specified, or must be followed by filter().', 1332489399); } } else { $selectorAndFilter = $arguments[0]; } $parsedFilter = FizzleParser::parseFilterGroup($selectorAndFilter); if (count($parsedFilter['Filters']) === 0) { throw new FizzleException('filter needs to be specified in children()', 1332489416); } elseif (count($parsedFilter['Filters']) === 1) { $filter = $parsedFilter['Filters'][0]; if (isset($filter['PropertyNameFilter'])) { $this->evaluatePropertyNameFilter($flowQuery, $filter['PropertyNameFilter']); if (isset($filter['AttributeFilters'])) { foreach ($filter['AttributeFilters'] as $attributeFilter) { $flowQuery->pushOperation('filter', [$attributeFilter['text']]); } } } elseif (isset($filter['AttributeFilters'])) { throw new FizzleException('children() must have a property name filter and cannot only have an attribute filter.', 1332489432); } } else { throw new FizzleException('children() only supports a single filter group right now, i.e. nothing of the form "filter1, filter2"', 1332489489); } }
[ "public", "function", "evaluate", "(", "FlowQuery", "$", "flowQuery", ",", "array", "$", "arguments", ")", "{", "if", "(", "count", "(", "$", "flowQuery", "->", "getContext", "(", ")", ")", "===", "0", ")", "{", "return", ";", "}", "if", "(", "!", ...
{@inheritdoc} @param FlowQuery $flowQuery the FlowQuery object @param array $arguments the filter expression to use (in index 0) @return void @throws FizzleException
[ "{", "@inheritdoc", "}" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/Object/ChildrenOperation.php#L43-L83
neos/flow-development-collection
Neos.Eel/Classes/FlowQuery/Operations/Object/ChildrenOperation.php
ChildrenOperation.evaluatePropertyNameFilter
protected function evaluatePropertyNameFilter(FlowQuery $query, $propertyNameFilter) { $resultObjects = []; $resultObjectHashes = []; foreach ($query->getContext() as $element) { $subProperty = ObjectAccess::getPropertyPath($element, $propertyNameFilter); if (is_object($subProperty) || is_array($subProperty)) { if (is_array($subProperty) || $subProperty instanceof \Traversable) { foreach ($subProperty as $childElement) { if (!isset($resultObjectHashes[spl_object_hash($childElement)])) { $resultObjectHashes[spl_object_hash($childElement)] = true; $resultObjects[] = $childElement; } } } elseif (!isset($resultObjectHashes[spl_object_hash($subProperty)])) { $resultObjectHashes[spl_object_hash($subProperty)] = true; $resultObjects[] = $subProperty; } } } $query->setContext($resultObjects); }
php
protected function evaluatePropertyNameFilter(FlowQuery $query, $propertyNameFilter) { $resultObjects = []; $resultObjectHashes = []; foreach ($query->getContext() as $element) { $subProperty = ObjectAccess::getPropertyPath($element, $propertyNameFilter); if (is_object($subProperty) || is_array($subProperty)) { if (is_array($subProperty) || $subProperty instanceof \Traversable) { foreach ($subProperty as $childElement) { if (!isset($resultObjectHashes[spl_object_hash($childElement)])) { $resultObjectHashes[spl_object_hash($childElement)] = true; $resultObjects[] = $childElement; } } } elseif (!isset($resultObjectHashes[spl_object_hash($subProperty)])) { $resultObjectHashes[spl_object_hash($subProperty)] = true; $resultObjects[] = $subProperty; } } } $query->setContext($resultObjects); }
[ "protected", "function", "evaluatePropertyNameFilter", "(", "FlowQuery", "$", "query", ",", "$", "propertyNameFilter", ")", "{", "$", "resultObjects", "=", "[", "]", ";", "$", "resultObjectHashes", "=", "[", "]", ";", "foreach", "(", "$", "query", "->", "get...
Evaluate the property name filter by traversing to the child object. We only support nested objects right now @param FlowQuery $query @param string $propertyNameFilter @return void
[ "Evaluate", "the", "property", "name", "filter", "by", "traversing", "to", "the", "child", "object", ".", "We", "only", "support", "nested", "objects", "right", "now" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/Object/ChildrenOperation.php#L93-L115
neos/flow-development-collection
Neos.FluidAdaptor/Classes/Core/Widget/AjaxWidgetContextHolder.php
AjaxWidgetContextHolder.get
public function get($ajaxWidgetId) { $ajaxWidgetId = (int) $ajaxWidgetId; if (!isset($this->widgetContexts[$ajaxWidgetId])) { throw new WidgetContextNotFoundException('No widget context was found for the Ajax Widget Identifier "' . $ajaxWidgetId . '". This only happens if AJAX URIs are called without including the widget on a page.', 1284793775); } return $this->widgetContexts[$ajaxWidgetId]; }
php
public function get($ajaxWidgetId) { $ajaxWidgetId = (int) $ajaxWidgetId; if (!isset($this->widgetContexts[$ajaxWidgetId])) { throw new WidgetContextNotFoundException('No widget context was found for the Ajax Widget Identifier "' . $ajaxWidgetId . '". This only happens if AJAX URIs are called without including the widget on a page.', 1284793775); } return $this->widgetContexts[$ajaxWidgetId]; }
[ "public", "function", "get", "(", "$", "ajaxWidgetId", ")", "{", "$", "ajaxWidgetId", "=", "(", "int", ")", "$", "ajaxWidgetId", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "widgetContexts", "[", "$", "ajaxWidgetId", "]", ")", ")", "{", "th...
Get the widget context for the given $ajaxWidgetId. @param integer $ajaxWidgetId @return WidgetContext @throws Exception\WidgetContextNotFoundException
[ "Get", "the", "widget", "context", "for", "the", "given", "$ajaxWidgetId", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Widget/AjaxWidgetContextHolder.php#L51-L58
neos/flow-development-collection
Neos.FluidAdaptor/Classes/Core/Widget/AjaxWidgetContextHolder.php
AjaxWidgetContextHolder.store
public function store(WidgetContext $widgetContext) { $ajaxWidgetId = $this->nextFreeAjaxWidgetId++; $widgetContext->setAjaxWidgetIdentifier($ajaxWidgetId); $this->widgetContexts[$ajaxWidgetId] = $widgetContext; }
php
public function store(WidgetContext $widgetContext) { $ajaxWidgetId = $this->nextFreeAjaxWidgetId++; $widgetContext->setAjaxWidgetIdentifier($ajaxWidgetId); $this->widgetContexts[$ajaxWidgetId] = $widgetContext; }
[ "public", "function", "store", "(", "WidgetContext", "$", "widgetContext", ")", "{", "$", "ajaxWidgetId", "=", "$", "this", "->", "nextFreeAjaxWidgetId", "++", ";", "$", "widgetContext", "->", "setAjaxWidgetIdentifier", "(", "$", "ajaxWidgetId", ")", ";", "$", ...
Stores the WidgetContext inside the Context, and sets the AjaxWidgetIdentifier inside the Widget Context correctly. @param WidgetContext $widgetContext @return void @Flow\Session(autoStart=true)
[ "Stores", "the", "WidgetContext", "inside", "the", "Context", "and", "sets", "the", "AjaxWidgetIdentifier", "inside", "the", "Widget", "Context", "correctly", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.FluidAdaptor/Classes/Core/Widget/AjaxWidgetContextHolder.php#L68-L73
neos/flow-development-collection
Neos.Flow/Classes/Cli/Command.php
Command.getShortDescription
public function getShortDescription(): string { $commandMethodReflection = $this->getCommandMethodReflection(); $lines = explode(chr(10), $commandMethodReflection->getDescription()); $shortDescription = ((count($lines) > 0) ? trim($lines[0]) : '<no description available>') . ($this->isDeprecated() ? ' <b>(DEPRECATED)</b>' : ''); if ($commandMethodReflection->getDeclaringClass()->implementsInterface(DescriptionAwareCommandControllerInterface::class)) { $shortDescription = call_user_func([$this->controllerClassName, 'processDescription'], $this->controllerCommandName, $shortDescription, $this->objectManager); } return $shortDescription; }
php
public function getShortDescription(): string { $commandMethodReflection = $this->getCommandMethodReflection(); $lines = explode(chr(10), $commandMethodReflection->getDescription()); $shortDescription = ((count($lines) > 0) ? trim($lines[0]) : '<no description available>') . ($this->isDeprecated() ? ' <b>(DEPRECATED)</b>' : ''); if ($commandMethodReflection->getDeclaringClass()->implementsInterface(DescriptionAwareCommandControllerInterface::class)) { $shortDescription = call_user_func([$this->controllerClassName, 'processDescription'], $this->controllerCommandName, $shortDescription, $this->objectManager); } return $shortDescription; }
[ "public", "function", "getShortDescription", "(", ")", ":", "string", "{", "$", "commandMethodReflection", "=", "$", "this", "->", "getCommandMethodReflection", "(", ")", ";", "$", "lines", "=", "explode", "(", "chr", "(", "10", ")", ",", "$", "commandMethod...
Returns a short description of this command @return string A short description
[ "Returns", "a", "short", "description", "of", "this", "command" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/Command.php#L121-L131
neos/flow-development-collection
Neos.Flow/Classes/Cli/Command.php
Command.getDescription
public function getDescription(): string { $commandMethodReflection = $this->getCommandMethodReflection(); $lines = explode(chr(10), $commandMethodReflection->getDescription()); array_shift($lines); $descriptionLines = []; foreach ($lines as $line) { $trimmedLine = trim($line); if ($descriptionLines !== [] || $trimmedLine !== '') { $descriptionLines[] = $trimmedLine; } } $description = implode(chr(10), $descriptionLines); if ($commandMethodReflection->getDeclaringClass()->implementsInterface(DescriptionAwareCommandControllerInterface::class)) { $description = call_user_func([$this->controllerClassName, 'processDescription'], $this->controllerCommandName, $description, $this->objectManager); } return $description; }
php
public function getDescription(): string { $commandMethodReflection = $this->getCommandMethodReflection(); $lines = explode(chr(10), $commandMethodReflection->getDescription()); array_shift($lines); $descriptionLines = []; foreach ($lines as $line) { $trimmedLine = trim($line); if ($descriptionLines !== [] || $trimmedLine !== '') { $descriptionLines[] = $trimmedLine; } } $description = implode(chr(10), $descriptionLines); if ($commandMethodReflection->getDeclaringClass()->implementsInterface(DescriptionAwareCommandControllerInterface::class)) { $description = call_user_func([$this->controllerClassName, 'processDescription'], $this->controllerCommandName, $description, $this->objectManager); } return $description; }
[ "public", "function", "getDescription", "(", ")", ":", "string", "{", "$", "commandMethodReflection", "=", "$", "this", "->", "getCommandMethodReflection", "(", ")", ";", "$", "lines", "=", "explode", "(", "chr", "(", "10", ")", ",", "$", "commandMethodRefle...
Returns a longer description of this command This is the complete method description except for the first line which can be retrieved via getShortDescription() If The command description only consists of one line, an empty string is returned @return string A longer description of this command
[ "Returns", "a", "longer", "description", "of", "this", "command", "This", "is", "the", "complete", "method", "description", "except", "for", "the", "first", "line", "which", "can", "be", "retrieved", "via", "getShortDescription", "()", "If", "The", "command", ...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/Command.php#L140-L157
neos/flow-development-collection
Neos.Flow/Classes/Cli/Command.php
Command.getArgumentDefinitions
public function getArgumentDefinitions(): array { if (!$this->hasArguments()) { return []; } $commandArgumentDefinitions = []; $commandMethodReflection = $this->getCommandMethodReflection(); $annotations = $commandMethodReflection->getTagsValues(); $commandParameters = $this->reflectionService->getMethodParameters($this->controllerClassName, $this->controllerCommandName . 'Command'); $i = 0; foreach ($commandParameters as $commandParameterName => $commandParameterDefinition) { $explodedAnnotation = explode(' ', $annotations['param'][$i]); array_shift($explodedAnnotation); array_shift($explodedAnnotation); $description = implode(' ', $explodedAnnotation); $required = $commandParameterDefinition['optional'] !== true; $commandArgumentDefinitions[] = new CommandArgumentDefinition($commandParameterName, $required, $description); $i ++; } return $commandArgumentDefinitions; }
php
public function getArgumentDefinitions(): array { if (!$this->hasArguments()) { return []; } $commandArgumentDefinitions = []; $commandMethodReflection = $this->getCommandMethodReflection(); $annotations = $commandMethodReflection->getTagsValues(); $commandParameters = $this->reflectionService->getMethodParameters($this->controllerClassName, $this->controllerCommandName . 'Command'); $i = 0; foreach ($commandParameters as $commandParameterName => $commandParameterDefinition) { $explodedAnnotation = explode(' ', $annotations['param'][$i]); array_shift($explodedAnnotation); array_shift($explodedAnnotation); $description = implode(' ', $explodedAnnotation); $required = $commandParameterDefinition['optional'] !== true; $commandArgumentDefinitions[] = new CommandArgumentDefinition($commandParameterName, $required, $description); $i ++; } return $commandArgumentDefinitions; }
[ "public", "function", "getArgumentDefinitions", "(", ")", ":", "array", "{", "if", "(", "!", "$", "this", "->", "hasArguments", "(", ")", ")", "{", "return", "[", "]", ";", "}", "$", "commandArgumentDefinitions", "=", "[", "]", ";", "$", "commandMethodRe...
Returns an array of CommandArgumentDefinition that contains information about required/optional arguments of this command. If the command does not expect any arguments, an empty array is returned @return array<CommandArgumentDefinition>
[ "Returns", "an", "array", "of", "CommandArgumentDefinition", "that", "contains", "information", "about", "required", "/", "optional", "arguments", "of", "this", "command", ".", "If", "the", "command", "does", "not", "expect", "any", "arguments", "an", "empty", "...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/Command.php#L176-L196
neos/flow-development-collection
Neos.Flow/Classes/Cli/Command.php
Command.getRelatedCommandIdentifiers
public function getRelatedCommandIdentifiers(): array { $commandMethodReflection = $this->getCommandMethodReflection(); if (!$commandMethodReflection->isTaggedWith('see')) { return []; } $relatedCommandIdentifiers = []; foreach ($commandMethodReflection->getTagValues('see') as $tagValue) { if (preg_match('/^[\w\.]+:[\w]+:[\w]+$/', $tagValue) === 1) { $relatedCommandIdentifiers[] = $tagValue; } } return $relatedCommandIdentifiers; }
php
public function getRelatedCommandIdentifiers(): array { $commandMethodReflection = $this->getCommandMethodReflection(); if (!$commandMethodReflection->isTaggedWith('see')) { return []; } $relatedCommandIdentifiers = []; foreach ($commandMethodReflection->getTagValues('see') as $tagValue) { if (preg_match('/^[\w\.]+:[\w]+:[\w]+$/', $tagValue) === 1) { $relatedCommandIdentifiers[] = $tagValue; } } return $relatedCommandIdentifiers; }
[ "public", "function", "getRelatedCommandIdentifiers", "(", ")", ":", "array", "{", "$", "commandMethodReflection", "=", "$", "this", "->", "getCommandMethodReflection", "(", ")", ";", "if", "(", "!", "$", "commandMethodReflection", "->", "isTaggedWith", "(", "'see...
Returns an array of command identifiers which were specified in the "@see" annotation of a command method. @return array
[ "Returns", "an", "array", "of", "command", "identifiers", "which", "were", "specified", "in", "the", "@see", "annotation", "of", "a", "command", "method", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Cli/Command.php#L240-L254
neos/flow-development-collection
Neos.Flow/Classes/Mvc/Routing/UriBuilder.php
UriBuilder.reset
public function reset() { $this->arguments = []; $this->section = ''; $this->format = null; $this->createAbsoluteUri = false; $this->addQueryString = false; $this->argumentsToBeExcludedFromQueryString = []; return $this; }
php
public function reset() { $this->arguments = []; $this->section = ''; $this->format = null; $this->createAbsoluteUri = false; $this->addQueryString = false; $this->argumentsToBeExcludedFromQueryString = []; return $this; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "arguments", "=", "[", "]", ";", "$", "this", "->", "section", "=", "''", ";", "$", "this", "->", "format", "=", "null", ";", "$", "this", "->", "createAbsoluteUri", "=", "false", ";"...
Resets all UriBuilder options to their default value. Note: This won't reset the Request that is attached to this UriBuilder (@see setRequest()) @return UriBuilder the current UriBuilder to allow method chaining @api
[ "Resets", "all", "UriBuilder", "options", "to", "their", "default", "value", ".", "Note", ":", "This", "won", "t", "reset", "the", "Request", "that", "is", "attached", "to", "this", "UriBuilder", "(", "@see", "setRequest", "()", ")" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/UriBuilder.php#L258-L268
neos/flow-development-collection
Neos.Flow/Classes/Mvc/Routing/UriBuilder.php
UriBuilder.uriFor
public function uriFor($actionName, $controllerArguments = [], $controllerName = null, $packageKey = null, $subPackageKey = null) { if ($actionName === null || $actionName === '') { throw new Exception\MissingActionNameException('The URI Builder could not build a URI linking to an action controller because no action name was specified. Please check the stack trace to see which code or template was requesting the link and check the arguments passed to the URI Builder.', 1354629891); } $controllerArguments['@action'] = strtolower($actionName); if ($controllerName !== null) { $controllerArguments['@controller'] = strtolower($controllerName); } else { $controllerArguments['@controller'] = strtolower($this->request->getControllerName()); } if ($packageKey === null && $subPackageKey === null) { $subPackageKey = $this->request->getControllerSubpackageKey(); } if ($packageKey === null) { $packageKey = $this->request->getControllerPackageKey(); } $controllerArguments['@package'] = strtolower($packageKey); if ($subPackageKey !== null) { $controllerArguments['@subpackage'] = strtolower($subPackageKey); } if ($this->format !== null && $this->format !== '') { $controllerArguments['@format'] = $this->format; } $controllerArguments = $this->addNamespaceToArguments($controllerArguments, $this->request); return $this->build($controllerArguments); }
php
public function uriFor($actionName, $controllerArguments = [], $controllerName = null, $packageKey = null, $subPackageKey = null) { if ($actionName === null || $actionName === '') { throw new Exception\MissingActionNameException('The URI Builder could not build a URI linking to an action controller because no action name was specified. Please check the stack trace to see which code or template was requesting the link and check the arguments passed to the URI Builder.', 1354629891); } $controllerArguments['@action'] = strtolower($actionName); if ($controllerName !== null) { $controllerArguments['@controller'] = strtolower($controllerName); } else { $controllerArguments['@controller'] = strtolower($this->request->getControllerName()); } if ($packageKey === null && $subPackageKey === null) { $subPackageKey = $this->request->getControllerSubpackageKey(); } if ($packageKey === null) { $packageKey = $this->request->getControllerPackageKey(); } $controllerArguments['@package'] = strtolower($packageKey); if ($subPackageKey !== null) { $controllerArguments['@subpackage'] = strtolower($subPackageKey); } if ($this->format !== null && $this->format !== '') { $controllerArguments['@format'] = $this->format; } $controllerArguments = $this->addNamespaceToArguments($controllerArguments, $this->request); return $this->build($controllerArguments); }
[ "public", "function", "uriFor", "(", "$", "actionName", ",", "$", "controllerArguments", "=", "[", "]", ",", "$", "controllerName", "=", "null", ",", "$", "packageKey", "=", "null", ",", "$", "subPackageKey", "=", "null", ")", "{", "if", "(", "$", "act...
Creates an URI used for linking to an Controller action. @param string $actionName Name of the action to be called @param array $controllerArguments Additional query parameters. Will be merged with $this->arguments. @param string $controllerName Name of the target controller. If not set, current ControllerName is used. @param string $packageKey Name of the target package. If not set, current Package is used. @param string $subPackageKey Name of the target SubPackage. If not set, current SubPackage is used. @return string the rendered URI @api @see build() @throws Exception\MissingActionNameException if $actionName parameter is empty
[ "Creates", "an", "URI", "used", "for", "linking", "to", "an", "Controller", "action", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/UriBuilder.php#L283-L310
neos/flow-development-collection
Neos.Flow/Classes/Mvc/Routing/UriBuilder.php
UriBuilder.addNamespaceToArguments
protected function addNamespaceToArguments(array $arguments, RequestInterface $currentRequest) { while (!$currentRequest->isMainRequest()) { $argumentNamespace = $currentRequest->getArgumentNamespace(); if ($argumentNamespace !== '') { $arguments = [$argumentNamespace => $arguments]; } $currentRequest = $currentRequest->getParentRequest(); } return $arguments; }
php
protected function addNamespaceToArguments(array $arguments, RequestInterface $currentRequest) { while (!$currentRequest->isMainRequest()) { $argumentNamespace = $currentRequest->getArgumentNamespace(); if ($argumentNamespace !== '') { $arguments = [$argumentNamespace => $arguments]; } $currentRequest = $currentRequest->getParentRequest(); } return $arguments; }
[ "protected", "function", "addNamespaceToArguments", "(", "array", "$", "arguments", ",", "RequestInterface", "$", "currentRequest", ")", "{", "while", "(", "!", "$", "currentRequest", "->", "isMainRequest", "(", ")", ")", "{", "$", "argumentNamespace", "=", "$",...
Adds the argument namespace of the current request to the specified arguments. This happens recursively iterating through the nested requests in case of a subrequest. For example if this is executed inside a widget sub request in a plugin sub request, the result would be: array( 'pluginRequestNamespace' => array( 'widgetRequestNamespace => $arguments ) ) @param array $arguments arguments @param RequestInterface $currentRequest @return array arguments with namespace
[ "Adds", "the", "argument", "namespace", "of", "the", "current", "request", "to", "the", "specified", "arguments", ".", "This", "happens", "recursively", "iterating", "through", "the", "nested", "requests", "in", "case", "of", "a", "subrequest", ".", "For", "ex...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/UriBuilder.php#L326-L336
neos/flow-development-collection
Neos.Flow/Classes/Mvc/Routing/UriBuilder.php
UriBuilder.build
public function build(array $arguments = []) { $arguments = Arrays::arrayMergeRecursiveOverrule($this->arguments, $arguments); $arguments = $this->mergeArgumentsWithRequestArguments($arguments); $httpRequest = $this->request->getHttpRequest(); $uriPathPrefix = $this->environment->isRewriteEnabled() ? '' : 'index.php/'; $uriPathPrefix = $httpRequest->getScriptRequestPath() . $uriPathPrefix; $resolveContext = new ResolveContext($httpRequest->getBaseUri(), $arguments, $this->createAbsoluteUri, $uriPathPrefix); $resolvedUri = $this->router->resolve($resolveContext); if ($this->section !== '') { $resolvedUri = $resolvedUri->withFragment($this->section); } $this->lastArguments = $arguments; return (string)$resolvedUri; }
php
public function build(array $arguments = []) { $arguments = Arrays::arrayMergeRecursiveOverrule($this->arguments, $arguments); $arguments = $this->mergeArgumentsWithRequestArguments($arguments); $httpRequest = $this->request->getHttpRequest(); $uriPathPrefix = $this->environment->isRewriteEnabled() ? '' : 'index.php/'; $uriPathPrefix = $httpRequest->getScriptRequestPath() . $uriPathPrefix; $resolveContext = new ResolveContext($httpRequest->getBaseUri(), $arguments, $this->createAbsoluteUri, $uriPathPrefix); $resolvedUri = $this->router->resolve($resolveContext); if ($this->section !== '') { $resolvedUri = $resolvedUri->withFragment($this->section); } $this->lastArguments = $arguments; return (string)$resolvedUri; }
[ "public", "function", "build", "(", "array", "$", "arguments", "=", "[", "]", ")", "{", "$", "arguments", "=", "Arrays", "::", "arrayMergeRecursiveOverrule", "(", "$", "this", "->", "arguments", ",", "$", "arguments", ")", ";", "$", "arguments", "=", "$"...
Builds the URI @param array $arguments optional URI arguments. Will be merged with $this->arguments with precedence to $arguments @return string the (absolute or relative) URI as string @api
[ "Builds", "the", "URI" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/UriBuilder.php#L345-L362
neos/flow-development-collection
Neos.Flow/Classes/Mvc/Routing/UriBuilder.php
UriBuilder.mergeArgumentsWithRequestArguments
protected function mergeArgumentsWithRequestArguments(array $arguments) { if ($this->request !== $this->request->getMainRequest()) { $subRequest = $this->request; while ($subRequest instanceof ActionRequest) { $requestArguments = (array)$subRequest->getArguments(); // Reset arguments for the request that is bound to this UriBuilder instance if ($subRequest === $this->request) { if ($this->addQueryString === false) { $requestArguments = []; } else { foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) { unset($requestArguments[$argumentToBeExcluded]); } } } else { // Remove all arguments of the current sub request if it's namespaced if ($this->request->getArgumentNamespace() !== '') { $requestNamespace = $this->getRequestNamespacePath($this->request); if ($this->addQueryString === false) { $requestArguments = Arrays::unsetValueByPath($requestArguments, $requestNamespace); } else { foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) { $requestArguments = Arrays::unsetValueByPath($requestArguments, $requestNamespace . '.' . $argumentToBeExcluded); } } } } // Merge special arguments (package, subpackage, controller & action) from main request $requestPackageKey = $subRequest->getControllerPackageKey(); if (!empty($requestPackageKey)) { $requestArguments['@package'] = $requestPackageKey; } $requestSubpackageKey = $subRequest->getControllerSubpackageKey(); if (!empty($requestSubpackageKey)) { $requestArguments['@subpackage'] = $requestSubpackageKey; } $requestControllerName = $subRequest->getControllerName(); if (!empty($requestControllerName)) { $requestArguments['@controller'] = $requestControllerName; } $requestActionName = $subRequest->getControllerActionName(); if (!empty($requestActionName)) { $requestArguments['@action'] = $requestActionName; } $requestFormat = $subRequest->getFormat(); if (!empty($requestFormat)) { $requestArguments['@format'] = $requestFormat; } if (count($requestArguments) > 0) { $requestArguments = $this->addNamespaceToArguments($requestArguments, $subRequest); $arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments); } $subRequest = $subRequest->getParentRequest(); } } elseif ($this->addQueryString === true) { $requestArguments = $this->request->getArguments(); foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) { unset($requestArguments[$argumentToBeExcluded]); } if ($requestArguments !== []) { $arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments); } } return $arguments; }
php
protected function mergeArgumentsWithRequestArguments(array $arguments) { if ($this->request !== $this->request->getMainRequest()) { $subRequest = $this->request; while ($subRequest instanceof ActionRequest) { $requestArguments = (array)$subRequest->getArguments(); // Reset arguments for the request that is bound to this UriBuilder instance if ($subRequest === $this->request) { if ($this->addQueryString === false) { $requestArguments = []; } else { foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) { unset($requestArguments[$argumentToBeExcluded]); } } } else { // Remove all arguments of the current sub request if it's namespaced if ($this->request->getArgumentNamespace() !== '') { $requestNamespace = $this->getRequestNamespacePath($this->request); if ($this->addQueryString === false) { $requestArguments = Arrays::unsetValueByPath($requestArguments, $requestNamespace); } else { foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) { $requestArguments = Arrays::unsetValueByPath($requestArguments, $requestNamespace . '.' . $argumentToBeExcluded); } } } } // Merge special arguments (package, subpackage, controller & action) from main request $requestPackageKey = $subRequest->getControllerPackageKey(); if (!empty($requestPackageKey)) { $requestArguments['@package'] = $requestPackageKey; } $requestSubpackageKey = $subRequest->getControllerSubpackageKey(); if (!empty($requestSubpackageKey)) { $requestArguments['@subpackage'] = $requestSubpackageKey; } $requestControllerName = $subRequest->getControllerName(); if (!empty($requestControllerName)) { $requestArguments['@controller'] = $requestControllerName; } $requestActionName = $subRequest->getControllerActionName(); if (!empty($requestActionName)) { $requestArguments['@action'] = $requestActionName; } $requestFormat = $subRequest->getFormat(); if (!empty($requestFormat)) { $requestArguments['@format'] = $requestFormat; } if (count($requestArguments) > 0) { $requestArguments = $this->addNamespaceToArguments($requestArguments, $subRequest); $arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments); } $subRequest = $subRequest->getParentRequest(); } } elseif ($this->addQueryString === true) { $requestArguments = $this->request->getArguments(); foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) { unset($requestArguments[$argumentToBeExcluded]); } if ($requestArguments !== []) { $arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments); } } return $arguments; }
[ "protected", "function", "mergeArgumentsWithRequestArguments", "(", "array", "$", "arguments", ")", "{", "if", "(", "$", "this", "->", "request", "!==", "$", "this", "->", "request", "->", "getMainRequest", "(", ")", ")", "{", "$", "subRequest", "=", "$", ...
Merges specified arguments with arguments from request. If $this->request is no sub request, request arguments will only be merged if $this->addQueryString is set. Otherwise all request arguments except for the ones prefixed with the current request argument namespace will be merged. Additionally special arguments (PackageKey, SubpackageKey, ControllerName & Action) are merged. The argument provided through the $arguments parameter always overrule the request arguments. The request hierarchy is structured as follows: root (HTTP) > main (Action) > sub (Action) > sub sub (Action) @param array $arguments @return array
[ "Merges", "specified", "arguments", "with", "arguments", "from", "request", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/UriBuilder.php#L380-L451
neos/flow-development-collection
Neos.Flow/Classes/Mvc/Routing/UriBuilder.php
UriBuilder.getRequestNamespacePath
protected function getRequestNamespacePath($request) { if (!$request instanceof Request) { $parentPath = $this->getRequestNamespacePath($request->getParentRequest()); return $parentPath . ($parentPath !== '' && $request->getArgumentNamespace() !== '' ? '.' : '') . $request->getArgumentNamespace(); } return ''; }
php
protected function getRequestNamespacePath($request) { if (!$request instanceof Request) { $parentPath = $this->getRequestNamespacePath($request->getParentRequest()); return $parentPath . ($parentPath !== '' && $request->getArgumentNamespace() !== '' ? '.' : '') . $request->getArgumentNamespace(); } return ''; }
[ "protected", "function", "getRequestNamespacePath", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "Request", ")", "{", "$", "parentPath", "=", "$", "this", "->", "getRequestNamespacePath", "(", "$", "request", "->", "getParentReq...
Get the path of the argument namespaces of all parent requests. Example: mainrequest.subrequest.subsubrequest @param ActionRequest $request @return string
[ "Get", "the", "path", "of", "the", "argument", "namespaces", "of", "all", "parent", "requests", ".", "Example", ":", "mainrequest", ".", "subrequest", ".", "subsubrequest" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Routing/UriBuilder.php#L460-L467
neos/flow-development-collection
Neos.Flow/Classes/Persistence/AbstractPersistenceManager.php
AbstractPersistenceManager.registerNewObject
public function registerNewObject(Aspect\PersistenceMagicInterface $object) { $identifier = ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true); $this->newObjects[$identifier] = $object; }
php
public function registerNewObject(Aspect\PersistenceMagicInterface $object) { $identifier = ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true); $this->newObjects[$identifier] = $object; }
[ "public", "function", "registerNewObject", "(", "Aspect", "\\", "PersistenceMagicInterface", "$", "object", ")", "{", "$", "identifier", "=", "ObjectAccess", "::", "getProperty", "(", "$", "object", ",", "'Persistence_Object_Identifier'", ",", "true", ")", ";", "$...
Registers an object which has been created or cloned during this request. The given object must contain the Persistence_Object_Identifier property, thus the PersistenceMagicInterface type hint. A "new" object does not necessarily have to be known by any repository or be persisted in the end. Objects registered with this method must be known to the getObjectByIdentifier() method. @param Aspect\PersistenceMagicInterface $object The new object to register @return void
[ "Registers", "an", "object", "which", "has", "been", "created", "or", "cloned", "during", "this", "request", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/AbstractPersistenceManager.php#L87-L91
neos/flow-development-collection
Neos.Flow/Classes/Persistence/AbstractPersistenceManager.php
AbstractPersistenceManager.throwExceptionIfObjectIsNotWhitelisted
protected function throwExceptionIfObjectIsNotWhitelisted($object) { if (!$this->whitelistedObjects->contains($object)) { $message = 'Detected modified or new objects (' . get_class($object) . ', uuid:' . $this->getIdentifierByObject($object) . ') to be persisted which is not allowed for "safe requests"' . chr(10) . 'According to the HTTP 1.1 specification, so called "safe request" (usually GET or HEAD requests)' . chr(10) . 'should not change your data on the server side and should be considered read-only. If you need to add,' . chr(10) . 'modify or remove data, you should use the respective request methods (POST, PUT, DELETE and PATCH).' . chr(10) . chr(10) . 'If you need to store some data during a safe request (for example, logging some data for your analytics),' . chr(10) . 'you are still free to call PersistenceManager->persistAll() manually.'; throw new PersistenceException($message, 1377788621); } }
php
protected function throwExceptionIfObjectIsNotWhitelisted($object) { if (!$this->whitelistedObjects->contains($object)) { $message = 'Detected modified or new objects (' . get_class($object) . ', uuid:' . $this->getIdentifierByObject($object) . ') to be persisted which is not allowed for "safe requests"' . chr(10) . 'According to the HTTP 1.1 specification, so called "safe request" (usually GET or HEAD requests)' . chr(10) . 'should not change your data on the server side and should be considered read-only. If you need to add,' . chr(10) . 'modify or remove data, you should use the respective request methods (POST, PUT, DELETE and PATCH).' . chr(10) . chr(10) . 'If you need to store some data during a safe request (for example, logging some data for your analytics),' . chr(10) . 'you are still free to call PersistenceManager->persistAll() manually.'; throw new PersistenceException($message, 1377788621); } }
[ "protected", "function", "throwExceptionIfObjectIsNotWhitelisted", "(", "$", "object", ")", "{", "if", "(", "!", "$", "this", "->", "whitelistedObjects", "->", "contains", "(", "$", "object", ")", ")", "{", "$", "message", "=", "'Detected modified or new objects (...
Checks if the given object is whitelisted and if not, throws an exception @param object $object @return void @throws \Neos\Flow\Persistence\Exception
[ "Checks", "if", "the", "given", "object", "is", "whitelisted", "and", "if", "not", "throws", "an", "exception" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/AbstractPersistenceManager.php#L113-L124
neos/flow-development-collection
Neos.Flow/Classes/Persistence/AbstractPersistenceManager.php
AbstractPersistenceManager.convertObjectToIdentityArray
public function convertObjectToIdentityArray($object) { $identifier = $this->getIdentifierByObject($object); if ($identifier === null) { throw new Exception\UnknownObjectException(sprintf('Tried to convert an object of type "%s" to an identity array, but it is unknown to the Persistence Manager.', get_class($object)), 1302628242); } return ['__identity' => $identifier]; }
php
public function convertObjectToIdentityArray($object) { $identifier = $this->getIdentifierByObject($object); if ($identifier === null) { throw new Exception\UnknownObjectException(sprintf('Tried to convert an object of type "%s" to an identity array, but it is unknown to the Persistence Manager.', get_class($object)), 1302628242); } return ['__identity' => $identifier]; }
[ "public", "function", "convertObjectToIdentityArray", "(", "$", "object", ")", "{", "$", "identifier", "=", "$", "this", "->", "getIdentifierByObject", "(", "$", "object", ")", ";", "if", "(", "$", "identifier", "===", "null", ")", "{", "throw", "new", "Ex...
Converts the given object into an array containing the identity of the domain object. @param object $object The object to be converted @return array The identity array in the format array('__identity' => '...') @throws Exception\UnknownObjectException if the given object is not known to the Persistence Manager
[ "Converts", "the", "given", "object", "into", "an", "array", "containing", "the", "identity", "of", "the", "domain", "object", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/AbstractPersistenceManager.php#L133-L140
neos/flow-development-collection
Neos.Flow/Classes/Persistence/AbstractPersistenceManager.php
AbstractPersistenceManager.convertObjectsToIdentityArrays
public function convertObjectsToIdentityArrays(array $array) { foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = $this->convertObjectsToIdentityArrays($value); } elseif (is_object($value) && $value instanceof \Traversable) { $array[$key] = $this->convertObjectsToIdentityArrays(iterator_to_array($value)); } elseif (is_object($value)) { $array[$key] = $this->convertObjectToIdentityArray($value); } } return $array; }
php
public function convertObjectsToIdentityArrays(array $array) { foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = $this->convertObjectsToIdentityArrays($value); } elseif (is_object($value) && $value instanceof \Traversable) { $array[$key] = $this->convertObjectsToIdentityArrays(iterator_to_array($value)); } elseif (is_object($value)) { $array[$key] = $this->convertObjectToIdentityArray($value); } } return $array; }
[ "public", "function", "convertObjectsToIdentityArrays", "(", "array", "$", "array", ")", "{", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "array", "[", "$...
Recursively iterates through the given array and turns objects into an arrays containing the identity of the domain object. @param array $array The array to be iterated over @return array The modified array without objects @throws Exception\UnknownObjectException if array contains objects that are not known to the Persistence Manager
[ "Recursively", "iterates", "through", "the", "given", "array", "and", "turns", "objects", "into", "an", "arrays", "containing", "the", "identity", "of", "the", "domain", "object", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/AbstractPersistenceManager.php#L150-L162
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Doctrine/CountWalker.php
CountWalker.walkSelectStatement
public function walkSelectStatement(\Doctrine\ORM\Query\AST\SelectStatement $AST) { $parent = null; $parentName = null; foreach ($this->_getQueryComponents() as $dqlAlias => $qComp) { if ($qComp['parent'] === null && $qComp['nestingLevel'] == 0) { $parent = $qComp; $parentName = $dqlAlias; break; } } $pathExpression = new PathExpression( PathExpression::TYPE_STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION, $parentName, $parent['metadata']->getSingleIdentifierFieldName() ); $pathExpression->type = PathExpression::TYPE_STATE_FIELD; $AST->selectClause->selectExpressions = [ new \Doctrine\ORM\Query\AST\SelectExpression( new \Doctrine\ORM\Query\AST\AggregateExpression('count', $pathExpression, true), null ) ]; // ORDER BY is not needed, only increases query execution through unnecessary sorting. $AST->orderByClause = null; }
php
public function walkSelectStatement(\Doctrine\ORM\Query\AST\SelectStatement $AST) { $parent = null; $parentName = null; foreach ($this->_getQueryComponents() as $dqlAlias => $qComp) { if ($qComp['parent'] === null && $qComp['nestingLevel'] == 0) { $parent = $qComp; $parentName = $dqlAlias; break; } } $pathExpression = new PathExpression( PathExpression::TYPE_STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION, $parentName, $parent['metadata']->getSingleIdentifierFieldName() ); $pathExpression->type = PathExpression::TYPE_STATE_FIELD; $AST->selectClause->selectExpressions = [ new \Doctrine\ORM\Query\AST\SelectExpression( new \Doctrine\ORM\Query\AST\AggregateExpression('count', $pathExpression, true), null ) ]; // ORDER BY is not needed, only increases query execution through unnecessary sorting. $AST->orderByClause = null; }
[ "public", "function", "walkSelectStatement", "(", "\\", "Doctrine", "\\", "ORM", "\\", "Query", "\\", "AST", "\\", "SelectStatement", "$", "AST", ")", "{", "$", "parent", "=", "null", ";", "$", "parentName", "=", "null", ";", "foreach", "(", "$", "this",...
Walks down a SelectStatement AST node, modifying it to retrieve a COUNT @param \Doctrine\ORM\Query\AST\SelectStatement $AST @return void
[ "Walks", "down", "a", "SelectStatement", "AST", "node", "modifying", "it", "to", "retrieve", "a", "COUNT" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Doctrine/CountWalker.php#L27-L53
neos/flow-development-collection
Neos.Flow/Classes/SignalSlot/Dispatcher.php
Dispatcher.connect
public function connect($signalClassName, $signalName, $slotClassNameOrObject, $slotMethodName = '', $passSignalInformation = true) { $class = null; $object = null; if (strpos($signalName, 'emit') === 0) { $possibleSignalName = lcfirst(substr($signalName, strlen('emit'))); throw new \InvalidArgumentException('The signal should not be connected with the method name ("' . $signalName . '"). Try "' . $possibleSignalName . '" for the signal name.', 1314016630); } if (is_object($slotClassNameOrObject)) { $object = $slotClassNameOrObject; $method = ($slotClassNameOrObject instanceof \Closure) ? '__invoke' : $slotMethodName; } else { if ($slotMethodName === '') { throw new \InvalidArgumentException('The slot method name must not be empty (except for closures).', 1229531659); } $class = $slotClassNameOrObject; $method = $slotMethodName; } $this->slots[$signalClassName][$signalName][] = [ 'class' => $class, 'method' => $method, 'object' => $object, 'passSignalInformation' => ($passSignalInformation === true) ]; }
php
public function connect($signalClassName, $signalName, $slotClassNameOrObject, $slotMethodName = '', $passSignalInformation = true) { $class = null; $object = null; if (strpos($signalName, 'emit') === 0) { $possibleSignalName = lcfirst(substr($signalName, strlen('emit'))); throw new \InvalidArgumentException('The signal should not be connected with the method name ("' . $signalName . '"). Try "' . $possibleSignalName . '" for the signal name.', 1314016630); } if (is_object($slotClassNameOrObject)) { $object = $slotClassNameOrObject; $method = ($slotClassNameOrObject instanceof \Closure) ? '__invoke' : $slotMethodName; } else { if ($slotMethodName === '') { throw new \InvalidArgumentException('The slot method name must not be empty (except for closures).', 1229531659); } $class = $slotClassNameOrObject; $method = $slotMethodName; } $this->slots[$signalClassName][$signalName][] = [ 'class' => $class, 'method' => $method, 'object' => $object, 'passSignalInformation' => ($passSignalInformation === true) ]; }
[ "public", "function", "connect", "(", "$", "signalClassName", ",", "$", "signalName", ",", "$", "slotClassNameOrObject", ",", "$", "slotMethodName", "=", "''", ",", "$", "passSignalInformation", "=", "true", ")", "{", "$", "class", "=", "null", ";", "$", "...
Connects a signal with a slot. One slot can be connected with multiple signals by calling this method multiple times. @param string $signalClassName Name of the class containing the signal @param string $signalName Name of the signal @param mixed $slotClassNameOrObject Name of the class containing the slot or the instantiated class or a Closure object @param string $slotMethodName Name of the method to be used as a slot. If $slotClassNameOrObject is a Closure object, this parameter is ignored @param boolean $passSignalInformation If set to true, the last argument passed to the slot will be information about the signal (EmitterClassName::signalName) @return void @throws \InvalidArgumentException @api
[ "Connects", "a", "signal", "with", "a", "slot", ".", "One", "slot", "can", "be", "connected", "with", "multiple", "signals", "by", "calling", "this", "method", "multiple", "times", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/SignalSlot/Dispatcher.php#L64-L91
neos/flow-development-collection
Neos.Flow/Classes/SignalSlot/Dispatcher.php
Dispatcher.dispatch
public function dispatch($signalClassName, $signalName, array $signalArguments = []) { if (!isset($this->slots[$signalClassName][$signalName])) { return; } foreach ($this->slots[$signalClassName][$signalName] as $slotInformation) { $finalSignalArguments = $signalArguments; if (isset($slotInformation['object'])) { $object = $slotInformation['object']; } elseif (substr($slotInformation['method'], 0, 2) === '::') { if (!isset($this->objectManager)) { if (is_callable($slotInformation['class'] . $slotInformation['method'])) { $object = $slotInformation['class']; } else { throw new Exception\InvalidSlotException(sprintf('Cannot dispatch %s::%s to class %s. The object manager is not yet available in the Signal Slot Dispatcher and therefore it cannot dispatch classes.', $signalClassName, $signalName, $slotInformation['class']), 1298113624); } } else { $object = $this->objectManager->getClassNameByObjectName($slotInformation['class']); } $slotInformation['method'] = substr($slotInformation['method'], 2); } else { if (!isset($this->objectManager)) { throw new Exception\InvalidSlotException(sprintf('Cannot dispatch %s::%s to class %s. The object manager is not yet available in the Signal Slot Dispatcher and therefore it cannot dispatch classes.', $signalClassName, $signalName, $slotInformation['class']), 1298113624); } if (!$this->objectManager->isRegistered($slotInformation['class'])) { throw new Exception\InvalidSlotException('The given class "' . $slotInformation['class'] . '" is not a registered object.', 1245673367); } $object = $this->objectManager->get($slotInformation['class']); } if ($slotInformation['passSignalInformation'] === true) { $finalSignalArguments[] = $signalClassName . '::' . $signalName; } if (!method_exists($object, $slotInformation['method'])) { throw new Exception\InvalidSlotException('The slot method ' . get_class($object) . '->' . $slotInformation['method'] . '() does not exist.', 1245673368); } call_user_func_array([$object, $slotInformation['method']], $finalSignalArguments); } }
php
public function dispatch($signalClassName, $signalName, array $signalArguments = []) { if (!isset($this->slots[$signalClassName][$signalName])) { return; } foreach ($this->slots[$signalClassName][$signalName] as $slotInformation) { $finalSignalArguments = $signalArguments; if (isset($slotInformation['object'])) { $object = $slotInformation['object']; } elseif (substr($slotInformation['method'], 0, 2) === '::') { if (!isset($this->objectManager)) { if (is_callable($slotInformation['class'] . $slotInformation['method'])) { $object = $slotInformation['class']; } else { throw new Exception\InvalidSlotException(sprintf('Cannot dispatch %s::%s to class %s. The object manager is not yet available in the Signal Slot Dispatcher and therefore it cannot dispatch classes.', $signalClassName, $signalName, $slotInformation['class']), 1298113624); } } else { $object = $this->objectManager->getClassNameByObjectName($slotInformation['class']); } $slotInformation['method'] = substr($slotInformation['method'], 2); } else { if (!isset($this->objectManager)) { throw new Exception\InvalidSlotException(sprintf('Cannot dispatch %s::%s to class %s. The object manager is not yet available in the Signal Slot Dispatcher and therefore it cannot dispatch classes.', $signalClassName, $signalName, $slotInformation['class']), 1298113624); } if (!$this->objectManager->isRegistered($slotInformation['class'])) { throw new Exception\InvalidSlotException('The given class "' . $slotInformation['class'] . '" is not a registered object.', 1245673367); } $object = $this->objectManager->get($slotInformation['class']); } if ($slotInformation['passSignalInformation'] === true) { $finalSignalArguments[] = $signalClassName . '::' . $signalName; } if (!method_exists($object, $slotInformation['method'])) { throw new Exception\InvalidSlotException('The slot method ' . get_class($object) . '->' . $slotInformation['method'] . '() does not exist.', 1245673368); } call_user_func_array([$object, $slotInformation['method']], $finalSignalArguments); } }
[ "public", "function", "dispatch", "(", "$", "signalClassName", ",", "$", "signalName", ",", "array", "$", "signalArguments", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "slots", "[", "$", "signalClassName", "]", "[", "$", ...
Dispatches a signal by calling the registered Slot methods @param string $signalClassName Name of the class containing the signal @param string $signalName Name of the signal @param array $signalArguments arguments passed to the signal method @return void @throws Exception\InvalidSlotException if the slot is not valid @api
[ "Dispatches", "a", "signal", "by", "calling", "the", "registered", "Slot", "methods" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/SignalSlot/Dispatcher.php#L103-L141
neos/flow-development-collection
Neos.Flow/Classes/SignalSlot/Dispatcher.php
Dispatcher.getSlots
public function getSlots($signalClassName, $signalName) { return (isset($this->slots[$signalClassName][$signalName])) ? $this->slots[$signalClassName][$signalName] : []; }
php
public function getSlots($signalClassName, $signalName) { return (isset($this->slots[$signalClassName][$signalName])) ? $this->slots[$signalClassName][$signalName] : []; }
[ "public", "function", "getSlots", "(", "$", "signalClassName", ",", "$", "signalName", ")", "{", "return", "(", "isset", "(", "$", "this", "->", "slots", "[", "$", "signalClassName", "]", "[", "$", "signalName", "]", ")", ")", "?", "$", "this", "->", ...
Returns all slots which are connected with the given signal @param string $signalClassName Name of the class containing the signal @param string $signalName Name of the signal @return array An array of arrays with slot information @api
[ "Returns", "all", "slots", "which", "are", "connected", "with", "the", "given", "signal" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/SignalSlot/Dispatcher.php#L151-L154
neos/flow-development-collection
Neos.Flow.Log/Classes/Backend/ConsoleBackend.php
ConsoleBackend.open
public function open() { $this->severityLabels = [ LOG_EMERG => 'EMERGENCY', LOG_ALERT => 'ALERT ', LOG_CRIT => 'CRITICAL ', LOG_ERR => 'ERROR ', LOG_WARNING => 'WARNING ', LOG_NOTICE => 'NOTICE ', LOG_INFO => 'INFO ', LOG_DEBUG => 'DEBUG ', ]; $this->streamHandle = fopen('php://' . $this->streamName, 'w'); if (!is_resource($this->streamHandle)) { throw new CouldNotOpenResourceException('Could not open stream "' . $this->streamName . '" for write access.', 1310986609); } }
php
public function open() { $this->severityLabels = [ LOG_EMERG => 'EMERGENCY', LOG_ALERT => 'ALERT ', LOG_CRIT => 'CRITICAL ', LOG_ERR => 'ERROR ', LOG_WARNING => 'WARNING ', LOG_NOTICE => 'NOTICE ', LOG_INFO => 'INFO ', LOG_DEBUG => 'DEBUG ', ]; $this->streamHandle = fopen('php://' . $this->streamName, 'w'); if (!is_resource($this->streamHandle)) { throw new CouldNotOpenResourceException('Could not open stream "' . $this->streamName . '" for write access.', 1310986609); } }
[ "public", "function", "open", "(", ")", "{", "$", "this", "->", "severityLabels", "=", "[", "LOG_EMERG", "=>", "'EMERGENCY'", ",", "LOG_ALERT", "=>", "'ALERT '", ",", "LOG_CRIT", "=>", "'CRITICAL '", ",", "LOG_ERR", "=>", "'ERROR '", ",", "LOG_WARNING", ...
Carries out all actions necessary to prepare the logging backend, such as opening the log file or opening a database connection. @return void @throws CouldNotOpenResourceException @api
[ "Carries", "out", "all", "actions", "necessary", "to", "prepare", "the", "logging", "backend", "such", "as", "opening", "the", "log", "file", "or", "opening", "a", "database", "connection", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow.Log/Classes/Backend/ConsoleBackend.php#L49-L66
neos/flow-development-collection
Neos.Flow.Log/Classes/Backend/ConsoleBackend.php
ConsoleBackend.append
public function append($message, $severity = LOG_INFO, $additionalData = null, $packageKey = null, $className = null, $methodName = null) { if ($severity > $this->severityThreshold) { return; } $severityLabel = (isset($this->severityLabels[$severity])) ? $this->severityLabels[$severity] : 'UNKNOWN '; $output = $severityLabel . ' ' . $message; if (!empty($additionalData)) { $output .= PHP_EOL . (new PlainTextFormatter($additionalData))->format(); } if (is_resource($this->streamHandle)) { fputs($this->streamHandle, $output . PHP_EOL); } }
php
public function append($message, $severity = LOG_INFO, $additionalData = null, $packageKey = null, $className = null, $methodName = null) { if ($severity > $this->severityThreshold) { return; } $severityLabel = (isset($this->severityLabels[$severity])) ? $this->severityLabels[$severity] : 'UNKNOWN '; $output = $severityLabel . ' ' . $message; if (!empty($additionalData)) { $output .= PHP_EOL . (new PlainTextFormatter($additionalData))->format(); } if (is_resource($this->streamHandle)) { fputs($this->streamHandle, $output . PHP_EOL); } }
[ "public", "function", "append", "(", "$", "message", ",", "$", "severity", "=", "LOG_INFO", ",", "$", "additionalData", "=", "null", ",", "$", "packageKey", "=", "null", ",", "$", "className", "=", "null", ",", "$", "methodName", "=", "null", ")", "{",...
Appends the given message along with the additional information into the log. @param string $message The message to log @param integer $severity One of the LOG_* constants @param mixed $additionalData A variable containing more information about the event to be logged @param string $packageKey Key of the package triggering the log (determined automatically if not specified) @param string $className Name of the class triggering the log (determined automatically if not specified) @param string $methodName Name of the method triggering the log (determined automatically if not specified) @return void @api
[ "Appends", "the", "given", "message", "along", "with", "the", "additional", "information", "into", "the", "log", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow.Log/Classes/Backend/ConsoleBackend.php#L80-L94
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/NumberParser.php
NumberParser.parseNumberWithCustomPattern
public function parseNumberWithCustomPattern($numberToParse, $format, Locale $locale, $strictMode = true) { return $this->doParsingWithParsedFormat($numberToParse, $this->numbersReader->parseCustomFormat($format), $this->numbersReader->getLocalizedSymbolsForLocale($locale), $strictMode); }
php
public function parseNumberWithCustomPattern($numberToParse, $format, Locale $locale, $strictMode = true) { return $this->doParsingWithParsedFormat($numberToParse, $this->numbersReader->parseCustomFormat($format), $this->numbersReader->getLocalizedSymbolsForLocale($locale), $strictMode); }
[ "public", "function", "parseNumberWithCustomPattern", "(", "$", "numberToParse", ",", "$", "format", ",", "Locale", "$", "locale", ",", "$", "strictMode", "=", "true", ")", "{", "return", "$", "this", "->", "doParsingWithParsedFormat", "(", "$", "numberToParse",...
Parses number given as a string using provided format. @param string $numberToParse Number to be parsed @param string $format Number format to use @param Locale $locale Locale to use @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Parsed float number or false on failure @api
[ "Parses", "number", "given", "as", "a", "string", "using", "provided", "format", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/NumberParser.php#L67-L70
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/NumberParser.php
NumberParser.parseDecimalNumber
public function parseDecimalNumber($numberToParse, Locale $locale, $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { NumbersReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($numberToParse, $this->numbersReader->parseFormatFromCldr($locale, NumbersReader::FORMAT_TYPE_DECIMAL, $formatLength), $this->numbersReader->getLocalizedSymbolsForLocale($locale), $strictMode); }
php
public function parseDecimalNumber($numberToParse, Locale $locale, $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { NumbersReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($numberToParse, $this->numbersReader->parseFormatFromCldr($locale, NumbersReader::FORMAT_TYPE_DECIMAL, $formatLength), $this->numbersReader->getLocalizedSymbolsForLocale($locale), $strictMode); }
[ "public", "function", "parseDecimalNumber", "(", "$", "numberToParse", ",", "Locale", "$", "locale", ",", "$", "formatLength", "=", "NumbersReader", "::", "FORMAT_LENGTH_DEFAULT", ",", "$", "strictMode", "=", "true", ")", "{", "NumbersReader", "::", "validateForma...
Parses decimal number using proper format from CLDR. @param string $numberToParse Number to be parsed @param Locale $locale Locale to use @param string $formatLength One of NumbersReader FORMAT_LENGTH constants @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Parsed float number or false on failure @api
[ "Parses", "decimal", "number", "using", "proper", "format", "from", "CLDR", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/NumberParser.php#L82-L86
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/NumberParser.php
NumberParser.parsePercentNumber
public function parsePercentNumber($numberToParse, Locale $locale, $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { NumbersReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($numberToParse, $this->numbersReader->parseFormatFromCldr($locale, NumbersReader::FORMAT_TYPE_PERCENT, $formatLength), $this->numbersReader->getLocalizedSymbolsForLocale($locale), $strictMode); }
php
public function parsePercentNumber($numberToParse, Locale $locale, $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { NumbersReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($numberToParse, $this->numbersReader->parseFormatFromCldr($locale, NumbersReader::FORMAT_TYPE_PERCENT, $formatLength), $this->numbersReader->getLocalizedSymbolsForLocale($locale), $strictMode); }
[ "public", "function", "parsePercentNumber", "(", "$", "numberToParse", ",", "Locale", "$", "locale", ",", "$", "formatLength", "=", "NumbersReader", "::", "FORMAT_LENGTH_DEFAULT", ",", "$", "strictMode", "=", "true", ")", "{", "NumbersReader", "::", "validateForma...
Parses percent number using proper format from CLDR. @param string $numberToParse Number to be parsed @param Locale $locale Locale to use @param string $formatLength One of NumbersReader FORMAT_LENGTH constants @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Parsed float number or false on failure @api
[ "Parses", "percent", "number", "using", "proper", "format", "from", "CLDR", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/NumberParser.php#L98-L102
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/NumberParser.php
NumberParser.doParsingWithParsedFormat
protected function doParsingWithParsedFormat($numberToParse, array $parsedFormat, array $localizedSymbols, $strictMode) { return ($strictMode) ? $this->doParsingInStrictMode($numberToParse, $parsedFormat, $localizedSymbols) : $this->doParsingInLenientMode($numberToParse, $parsedFormat, $localizedSymbols); }
php
protected function doParsingWithParsedFormat($numberToParse, array $parsedFormat, array $localizedSymbols, $strictMode) { return ($strictMode) ? $this->doParsingInStrictMode($numberToParse, $parsedFormat, $localizedSymbols) : $this->doParsingInLenientMode($numberToParse, $parsedFormat, $localizedSymbols); }
[ "protected", "function", "doParsingWithParsedFormat", "(", "$", "numberToParse", ",", "array", "$", "parsedFormat", ",", "array", "$", "localizedSymbols", ",", "$", "strictMode", ")", "{", "return", "(", "$", "strictMode", ")", "?", "$", "this", "->", "doParsi...
Parses number using parsed format, in strict or lenient mode. @param string $numberToParse Number to be parsed @param array $parsedFormat Parsed format (from NumbersReader) @param array $localizedSymbols An array with symbols to use @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Parsed float number or false on failure
[ "Parses", "number", "using", "parsed", "format", "in", "strict", "or", "lenient", "mode", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/NumberParser.php#L113-L116
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/NumberParser.php
NumberParser.doParsingInStrictMode
protected function doParsingInStrictMode($numberToParse, array $parsedFormat, array $localizedSymbols) { $numberIsNegative = false; if (!empty($parsedFormat['negativePrefix']) && !empty($parsedFormat['negativeSuffix'])) { if (Utility::stringBeginsWith($numberToParse, $parsedFormat['negativePrefix']) && Utility::stringEndsWith($numberToParse, $parsedFormat['negativeSuffix'])) { $numberToParse = substr($numberToParse, strlen($parsedFormat['negativePrefix']), - strlen($parsedFormat['negativeSuffix'])); $numberIsNegative = true; } } elseif (!empty($parsedFormat['negativePrefix']) && Utility::stringBeginsWith($numberToParse, $parsedFormat['negativePrefix'])) { $numberToParse = substr($numberToParse, strlen($parsedFormat['negativePrefix'])); $numberIsNegative = true; } elseif (!empty($parsedFormat['negativeSuffix']) && Utility::stringEndsWith($numberToParse, $parsedFormat['negativeSuffix'])) { $numberToParse = substr($numberToParse, 0, - strlen($parsedFormat['negativeSuffix'])); $numberIsNegative = true; } if (!$numberIsNegative) { if (!empty($parsedFormat['positivePrefix']) && !empty($parsedFormat['positiveSuffix'])) { if (Utility::stringBeginsWith($numberToParse, $parsedFormat['positivePrefix']) && Utility::stringEndsWith($numberToParse, $parsedFormat['positiveSuffix'])) { $numberToParse = substr($numberToParse, strlen($parsedFormat['positivePrefix']), - strlen($parsedFormat['positiveSuffix'])); } else { return false; } } elseif (!empty($parsedFormat['positivePrefix'])) { if (Utility::stringBeginsWith($numberToParse, $parsedFormat['positivePrefix'])) { $numberToParse = substr($numberToParse, strlen($parsedFormat['positivePrefix'])); } else { return false; } } elseif (!empty($parsedFormat['positiveSuffix'])) { if (Utility::stringEndsWith($numberToParse, $parsedFormat['positiveSuffix'])) { $numberToParse = substr($numberToParse, 0, - strlen($parsedFormat['positiveSuffix'])); } else { return false; } } } $positionOfDecimalSeparator = strpos($numberToParse, $localizedSymbols['decimal']); if ($positionOfDecimalSeparator === false) { $numberToParse = str_replace($localizedSymbols['group'], '', $numberToParse); if (strlen($numberToParse) < $parsedFormat['minIntegerDigits']) { return false; } elseif (preg_match(self::PATTERN_MATCH_DIGITS, $numberToParse, $matches) !== 1) { return false; } $integerPart = $numberToParse; $decimalPart = false; } else { if ($positionOfDecimalSeparator === 0 && $positionOfDecimalSeparator === strlen($numberToParse) - 1) { return false; } $numberToParse = str_replace([$localizedSymbols['group'], $localizedSymbols['decimal']], ['', '.'], $numberToParse); $positionOfDecimalSeparator = strpos($numberToParse, '.'); $integerPart = substr($numberToParse, 0, $positionOfDecimalSeparator); $decimalPart = substr($numberToParse, $positionOfDecimalSeparator + 1); } if (strlen($integerPart) < $parsedFormat['minIntegerDigits']) { return false; } elseif (preg_match(self::PATTERN_MATCH_DIGITS, $integerPart, $matches) !== 1) { return false; } $parsedNumber = (int)$integerPart; if ($decimalPart !== false) { $countOfDecimalDigits = strlen($decimalPart); if ($countOfDecimalDigits < $parsedFormat['minDecimalDigits'] || $countOfDecimalDigits > $parsedFormat['maxDecimalDigits']) { return false; } elseif (preg_match(self::PATTERN_MATCH_DIGITS, $decimalPart, $matches) !== 1) { return false; } $parsedNumber = (float)($integerPart . '.' . $decimalPart); } $parsedNumber /= $parsedFormat['multiplier']; if ($parsedFormat['rounding'] !== 0.0 && ($parsedNumber - (int)($parsedNumber / $parsedFormat['rounding']) * $parsedFormat['rounding']) !== 0.0) { return false; } if ($numberIsNegative) { $parsedNumber = 0 - $parsedNumber; } return $parsedNumber; }
php
protected function doParsingInStrictMode($numberToParse, array $parsedFormat, array $localizedSymbols) { $numberIsNegative = false; if (!empty($parsedFormat['negativePrefix']) && !empty($parsedFormat['negativeSuffix'])) { if (Utility::stringBeginsWith($numberToParse, $parsedFormat['negativePrefix']) && Utility::stringEndsWith($numberToParse, $parsedFormat['negativeSuffix'])) { $numberToParse = substr($numberToParse, strlen($parsedFormat['negativePrefix']), - strlen($parsedFormat['negativeSuffix'])); $numberIsNegative = true; } } elseif (!empty($parsedFormat['negativePrefix']) && Utility::stringBeginsWith($numberToParse, $parsedFormat['negativePrefix'])) { $numberToParse = substr($numberToParse, strlen($parsedFormat['negativePrefix'])); $numberIsNegative = true; } elseif (!empty($parsedFormat['negativeSuffix']) && Utility::stringEndsWith($numberToParse, $parsedFormat['negativeSuffix'])) { $numberToParse = substr($numberToParse, 0, - strlen($parsedFormat['negativeSuffix'])); $numberIsNegative = true; } if (!$numberIsNegative) { if (!empty($parsedFormat['positivePrefix']) && !empty($parsedFormat['positiveSuffix'])) { if (Utility::stringBeginsWith($numberToParse, $parsedFormat['positivePrefix']) && Utility::stringEndsWith($numberToParse, $parsedFormat['positiveSuffix'])) { $numberToParse = substr($numberToParse, strlen($parsedFormat['positivePrefix']), - strlen($parsedFormat['positiveSuffix'])); } else { return false; } } elseif (!empty($parsedFormat['positivePrefix'])) { if (Utility::stringBeginsWith($numberToParse, $parsedFormat['positivePrefix'])) { $numberToParse = substr($numberToParse, strlen($parsedFormat['positivePrefix'])); } else { return false; } } elseif (!empty($parsedFormat['positiveSuffix'])) { if (Utility::stringEndsWith($numberToParse, $parsedFormat['positiveSuffix'])) { $numberToParse = substr($numberToParse, 0, - strlen($parsedFormat['positiveSuffix'])); } else { return false; } } } $positionOfDecimalSeparator = strpos($numberToParse, $localizedSymbols['decimal']); if ($positionOfDecimalSeparator === false) { $numberToParse = str_replace($localizedSymbols['group'], '', $numberToParse); if (strlen($numberToParse) < $parsedFormat['minIntegerDigits']) { return false; } elseif (preg_match(self::PATTERN_MATCH_DIGITS, $numberToParse, $matches) !== 1) { return false; } $integerPart = $numberToParse; $decimalPart = false; } else { if ($positionOfDecimalSeparator === 0 && $positionOfDecimalSeparator === strlen($numberToParse) - 1) { return false; } $numberToParse = str_replace([$localizedSymbols['group'], $localizedSymbols['decimal']], ['', '.'], $numberToParse); $positionOfDecimalSeparator = strpos($numberToParse, '.'); $integerPart = substr($numberToParse, 0, $positionOfDecimalSeparator); $decimalPart = substr($numberToParse, $positionOfDecimalSeparator + 1); } if (strlen($integerPart) < $parsedFormat['minIntegerDigits']) { return false; } elseif (preg_match(self::PATTERN_MATCH_DIGITS, $integerPart, $matches) !== 1) { return false; } $parsedNumber = (int)$integerPart; if ($decimalPart !== false) { $countOfDecimalDigits = strlen($decimalPart); if ($countOfDecimalDigits < $parsedFormat['minDecimalDigits'] || $countOfDecimalDigits > $parsedFormat['maxDecimalDigits']) { return false; } elseif (preg_match(self::PATTERN_MATCH_DIGITS, $decimalPart, $matches) !== 1) { return false; } $parsedNumber = (float)($integerPart . '.' . $decimalPart); } $parsedNumber /= $parsedFormat['multiplier']; if ($parsedFormat['rounding'] !== 0.0 && ($parsedNumber - (int)($parsedNumber / $parsedFormat['rounding']) * $parsedFormat['rounding']) !== 0.0) { return false; } if ($numberIsNegative) { $parsedNumber = 0 - $parsedNumber; } return $parsedNumber; }
[ "protected", "function", "doParsingInStrictMode", "(", "$", "numberToParse", ",", "array", "$", "parsedFormat", ",", "array", "$", "localizedSymbols", ")", "{", "$", "numberIsNegative", "=", "false", ";", "if", "(", "!", "empty", "(", "$", "parsedFormat", "[",...
Parses number in strict mode. In strict mode parser checks all constraints of provided parsed format, and if any of them is not fullfiled, parsing fails (false is returned). @param string $numberToParse Number to be parsed @param array $parsedFormat Parsed format (from NumbersReader) @param array $localizedSymbols An array with symbols to use @return mixed Parsed float number or false on failure
[ "Parses", "number", "in", "strict", "mode", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/NumberParser.php#L129-L222
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/NumberParser.php
NumberParser.doParsingInLenientMode
protected function doParsingInLenientMode($numberToParse, array $parsedFormat, array $localizedSymbols) { $numberIsNegative = false; $positionOfFirstDigit = null; $positionOfLastDigit = null; $charactersOfNumberString = str_split($numberToParse); foreach ($charactersOfNumberString as $position => $character) { if (ord($character) >= 48 && ord($character) <= 57) { $positionOfFirstDigit = $position; break; } } if ($positionOfFirstDigit === null) { return false; } krsort($charactersOfNumberString); foreach ($charactersOfNumberString as $position => $character) { if (ord($character) >= 48 && ord($character) <= 57) { $positionOfLastDigit = $position; break; } } $positionOfDecimalSeparator = strrpos($numberToParse, $localizedSymbols['decimal'], $positionOfFirstDigit); if ($positionOfDecimalSeparator === false) { $integerPart = substr($numberToParse, $positionOfFirstDigit, $positionOfLastDigit - $positionOfFirstDigit + 1); $decimalPart = false; } else { $integerPart = substr($numberToParse, $positionOfFirstDigit, $positionOfDecimalSeparator - $positionOfFirstDigit); $decimalPart = substr($numberToParse, $positionOfDecimalSeparator + 1, $positionOfLastDigit - $positionOfDecimalSeparator); } $parsedNumber = (int)preg_replace(self::PATTERN_MATCH_NOT_DIGITS, '', $integerPart); if ($decimalPart !== false) { $decimalPart = (int)preg_replace(self::PATTERN_MATCH_NOT_DIGITS, '', $decimalPart); $parsedNumber = (float)($parsedNumber . '.' . $decimalPart); } $partBeforeNumber = substr($numberToParse, 0, $positionOfFirstDigit); $partAfterNumber = substr($numberToParse, - (strlen($numberToParse) - $positionOfLastDigit - 1)); if (!empty($parsedFormat['negativePrefix']) && !empty($parsedFormat['negativeSuffix'])) { if (Utility::stringEndsWith($partBeforeNumber, $parsedFormat['negativePrefix']) && Utility::stringBeginsWith($partAfterNumber, $parsedFormat['negativeSuffix'])) { $numberIsNegative = true; } } elseif (!empty($parsedFormat['negativePrefix']) && Utility::stringEndsWith($partBeforeNumber, $parsedFormat['negativePrefix'])) { $numberIsNegative = true; } elseif (!empty($parsedFormat['negativeSuffix']) && Utility::stringBeginsWith($partAfterNumber, $parsedFormat['negativeSuffix'])) { $numberIsNegative = true; } $parsedNumber /= $parsedFormat['multiplier']; if ($numberIsNegative) { $parsedNumber = 0 - $parsedNumber; } return $parsedNumber; }
php
protected function doParsingInLenientMode($numberToParse, array $parsedFormat, array $localizedSymbols) { $numberIsNegative = false; $positionOfFirstDigit = null; $positionOfLastDigit = null; $charactersOfNumberString = str_split($numberToParse); foreach ($charactersOfNumberString as $position => $character) { if (ord($character) >= 48 && ord($character) <= 57) { $positionOfFirstDigit = $position; break; } } if ($positionOfFirstDigit === null) { return false; } krsort($charactersOfNumberString); foreach ($charactersOfNumberString as $position => $character) { if (ord($character) >= 48 && ord($character) <= 57) { $positionOfLastDigit = $position; break; } } $positionOfDecimalSeparator = strrpos($numberToParse, $localizedSymbols['decimal'], $positionOfFirstDigit); if ($positionOfDecimalSeparator === false) { $integerPart = substr($numberToParse, $positionOfFirstDigit, $positionOfLastDigit - $positionOfFirstDigit + 1); $decimalPart = false; } else { $integerPart = substr($numberToParse, $positionOfFirstDigit, $positionOfDecimalSeparator - $positionOfFirstDigit); $decimalPart = substr($numberToParse, $positionOfDecimalSeparator + 1, $positionOfLastDigit - $positionOfDecimalSeparator); } $parsedNumber = (int)preg_replace(self::PATTERN_MATCH_NOT_DIGITS, '', $integerPart); if ($decimalPart !== false) { $decimalPart = (int)preg_replace(self::PATTERN_MATCH_NOT_DIGITS, '', $decimalPart); $parsedNumber = (float)($parsedNumber . '.' . $decimalPart); } $partBeforeNumber = substr($numberToParse, 0, $positionOfFirstDigit); $partAfterNumber = substr($numberToParse, - (strlen($numberToParse) - $positionOfLastDigit - 1)); if (!empty($parsedFormat['negativePrefix']) && !empty($parsedFormat['negativeSuffix'])) { if (Utility::stringEndsWith($partBeforeNumber, $parsedFormat['negativePrefix']) && Utility::stringBeginsWith($partAfterNumber, $parsedFormat['negativeSuffix'])) { $numberIsNegative = true; } } elseif (!empty($parsedFormat['negativePrefix']) && Utility::stringEndsWith($partBeforeNumber, $parsedFormat['negativePrefix'])) { $numberIsNegative = true; } elseif (!empty($parsedFormat['negativeSuffix']) && Utility::stringBeginsWith($partAfterNumber, $parsedFormat['negativeSuffix'])) { $numberIsNegative = true; } $parsedNumber /= $parsedFormat['multiplier']; if ($numberIsNegative) { $parsedNumber = 0 - $parsedNumber; } return $parsedNumber; }
[ "protected", "function", "doParsingInLenientMode", "(", "$", "numberToParse", ",", "array", "$", "parsedFormat", ",", "array", "$", "localizedSymbols", ")", "{", "$", "numberIsNegative", "=", "false", ";", "$", "positionOfFirstDigit", "=", "null", ";", "$", "pos...
Parses number in lenient mode. Lenient parsing ignores everything that can be ignored, and tries to extract number from the string, even if it's not well formed. Implementation is simple but should work more often than strict parsing. Algorithm: 1. Find first digit 2. Find last digit 3. Find decimal separator between first and last digit (if any) 4. Remove non-digits from integer part 5. Remove non-digits from decimal part (optional) 6. Try to match negative prefix before first digit 7. Try to match negative suffix after last digit @param string $numberToParse Number to be parsed @param array $parsedFormat Parsed format (from NumbersReader) @param array $localizedSymbols An array with symbols to use @return mixed Parsed float number or false on failure
[ "Parses", "number", "in", "lenient", "mode", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/NumberParser.php#L246-L308
neos/flow-development-collection
Neos.Flow/Classes/Core/ClassLoader.php
ClassLoader.loadClass
public function loadClass(string $className): bool { $className = ltrim($className, '\\'); $namespaceParts = explode('\\', $className); // Workaround for Doctrine's annotation parser which does a class_exists() for annotations like "@param" and so on: if (isset($this->ignoredClassNames[$className]) || isset($this->ignoredClassNames[end($namespaceParts)]) || isset($this->nonExistentClasses[$className])) { return false; } $classNamePart = array_pop($namespaceParts); $classNameParts = explode('_', $classNamePart); $namespaceParts = array_merge($namespaceParts, $classNameParts); $namespacePartCount = count($namespaceParts); $currentPackageArray = $this->packageNamespaces; $packagenamespacePartCount = 0; // This will contain all possible class mappings for the given class name. We start with the fallback paths and prepend mappings with growing specificy. $collectedPossibleNamespaceMappings = [ ['p' => $this->fallbackClassPaths, 'c' => 0] ]; if ($namespacePartCount > 1) { while (($packagenamespacePartCount + 1) < $namespacePartCount) { $possiblePackageNamespacePart = $namespaceParts[$packagenamespacePartCount]; if (!isset($currentPackageArray[$possiblePackageNamespacePart])) { break; } $packagenamespacePartCount++; $currentPackageArray = $currentPackageArray[$possiblePackageNamespacePart]; if (isset($currentPackageArray['_pathData'])) { array_unshift($collectedPossibleNamespaceMappings, ['p' => $currentPackageArray['_pathData'], 'c' => $packagenamespacePartCount]); } } } foreach ($collectedPossibleNamespaceMappings as $nameSpaceMapping) { if ($this->loadClassFromPossiblePaths($nameSpaceMapping['p'], $namespaceParts, $nameSpaceMapping['c'])) { return true; } } $this->nonExistentClasses[$className] = true; return false; }
php
public function loadClass(string $className): bool { $className = ltrim($className, '\\'); $namespaceParts = explode('\\', $className); // Workaround for Doctrine's annotation parser which does a class_exists() for annotations like "@param" and so on: if (isset($this->ignoredClassNames[$className]) || isset($this->ignoredClassNames[end($namespaceParts)]) || isset($this->nonExistentClasses[$className])) { return false; } $classNamePart = array_pop($namespaceParts); $classNameParts = explode('_', $classNamePart); $namespaceParts = array_merge($namespaceParts, $classNameParts); $namespacePartCount = count($namespaceParts); $currentPackageArray = $this->packageNamespaces; $packagenamespacePartCount = 0; // This will contain all possible class mappings for the given class name. We start with the fallback paths and prepend mappings with growing specificy. $collectedPossibleNamespaceMappings = [ ['p' => $this->fallbackClassPaths, 'c' => 0] ]; if ($namespacePartCount > 1) { while (($packagenamespacePartCount + 1) < $namespacePartCount) { $possiblePackageNamespacePart = $namespaceParts[$packagenamespacePartCount]; if (!isset($currentPackageArray[$possiblePackageNamespacePart])) { break; } $packagenamespacePartCount++; $currentPackageArray = $currentPackageArray[$possiblePackageNamespacePart]; if (isset($currentPackageArray['_pathData'])) { array_unshift($collectedPossibleNamespaceMappings, ['p' => $currentPackageArray['_pathData'], 'c' => $packagenamespacePartCount]); } } } foreach ($collectedPossibleNamespaceMappings as $nameSpaceMapping) { if ($this->loadClassFromPossiblePaths($nameSpaceMapping['p'], $namespaceParts, $nameSpaceMapping['c'])) { return true; } } $this->nonExistentClasses[$className] = true; return false; }
[ "public", "function", "loadClass", "(", "string", "$", "className", ")", ":", "bool", "{", "$", "className", "=", "ltrim", "(", "$", "className", ",", "'\\\\'", ")", ";", "$", "namespaceParts", "=", "explode", "(", "'\\\\'", ",", "$", "className", ")", ...
Loads php files containing classes or interfaces found in the classes directory of a package and specifically registered classes. @param string $className Name of the class/interface to load @return boolean
[ "Loads", "php", "files", "containing", "classes", "or", "interfaces", "found", "in", "the", "classes", "directory", "of", "a", "package", "and", "specifically", "registered", "classes", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/ClassLoader.php#L112-L157
neos/flow-development-collection
Neos.Flow/Classes/Core/ClassLoader.php
ClassLoader.loadClassFromPossiblePaths
protected function loadClassFromPossiblePaths(array $possiblePaths, array $namespaceParts, int $packageNamespacePartCount): bool { foreach ($possiblePaths as $possiblePathData) { $possibleFilePath = ''; if ($possiblePathData['mappingType'] === self::MAPPING_TYPE_PSR0) { $possibleFilePath = $this->buildClassPathWithPsr0($namespaceParts, $possiblePathData['path'], $packageNamespacePartCount); } if ($possiblePathData['mappingType'] === self::MAPPING_TYPE_PSR4) { $possibleFilePath = $this->buildClassPathWithPsr4($namespaceParts, $possiblePathData['path'], $packageNamespacePartCount); } if (is_file($possibleFilePath)) { $result = include_once($possibleFilePath); if ($result !== false) { return true; } } } return false; }
php
protected function loadClassFromPossiblePaths(array $possiblePaths, array $namespaceParts, int $packageNamespacePartCount): bool { foreach ($possiblePaths as $possiblePathData) { $possibleFilePath = ''; if ($possiblePathData['mappingType'] === self::MAPPING_TYPE_PSR0) { $possibleFilePath = $this->buildClassPathWithPsr0($namespaceParts, $possiblePathData['path'], $packageNamespacePartCount); } if ($possiblePathData['mappingType'] === self::MAPPING_TYPE_PSR4) { $possibleFilePath = $this->buildClassPathWithPsr4($namespaceParts, $possiblePathData['path'], $packageNamespacePartCount); } if (is_file($possibleFilePath)) { $result = include_once($possibleFilePath); if ($result !== false) { return true; } } } return false; }
[ "protected", "function", "loadClassFromPossiblePaths", "(", "array", "$", "possiblePaths", ",", "array", "$", "namespaceParts", ",", "int", "$", "packageNamespacePartCount", ")", ":", "bool", "{", "foreach", "(", "$", "possiblePaths", "as", "$", "possiblePathData", ...
Tries to load a class from a list of possible paths. This is needed because packages are not prefix-free; i.e. there may exist a package "Neos" and a package "Neos.NodeTypes" -- so a class Neos\NodeTypes\Foo must be first loaded (if it exists) from Neos.NodeTypes, falling back to Neos afterwards. @param array $possiblePaths @param array $namespaceParts @param integer $packageNamespacePartCount @return boolean
[ "Tries", "to", "load", "a", "class", "from", "a", "list", "of", "possible", "paths", ".", "This", "is", "needed", "because", "packages", "are", "not", "prefix", "-", "free", ";", "i", ".", "e", ".", "there", "may", "exist", "a", "package", "Neos", "a...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/ClassLoader.php#L169-L189
neos/flow-development-collection
Neos.Flow/Classes/Core/ClassLoader.php
ClassLoader.setPackages
public function setPackages(array $activePackages) { /** @var Package $package */ foreach ($activePackages as $packageKey => $package) { foreach ($package->getFlattenedAutoloadConfiguration() as $configuration) { $this->createNamespaceMapEntry($configuration['namespace'], $configuration['classPath'], $configuration['mappingType']); } // TODO: Replace with "autoload-dev" usage if ($this->considerTestsNamespace) { foreach ($package->getNamespaces() as $namespace) { $this->createNamespaceMapEntry($namespace, $package->getPackagePath(), self::MAPPING_TYPE_PSR4); } } } }
php
public function setPackages(array $activePackages) { /** @var Package $package */ foreach ($activePackages as $packageKey => $package) { foreach ($package->getFlattenedAutoloadConfiguration() as $configuration) { $this->createNamespaceMapEntry($configuration['namespace'], $configuration['classPath'], $configuration['mappingType']); } // TODO: Replace with "autoload-dev" usage if ($this->considerTestsNamespace) { foreach ($package->getNamespaces() as $namespace) { $this->createNamespaceMapEntry($namespace, $package->getPackagePath(), self::MAPPING_TYPE_PSR4); } } } }
[ "public", "function", "setPackages", "(", "array", "$", "activePackages", ")", "{", "/** @var Package $package */", "foreach", "(", "$", "activePackages", "as", "$", "packageKey", "=>", "$", "package", ")", "{", "foreach", "(", "$", "package", "->", "getFlattene...
Sets the available packages @param array $activePackages An array of \Neos\Flow\Package\Package objects @return void
[ "Sets", "the", "available", "packages" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/ClassLoader.php#L197-L211
neos/flow-development-collection
Neos.Flow/Classes/Core/ClassLoader.php
ClassLoader.createNamespaceMapEntry
protected function createNamespaceMapEntry(string $namespace, string $classPath, string $mappingType = self::MAPPING_TYPE_PSR0) { $unifiedClassPath = Files::getNormalizedPath($classPath); $entryIdentifier = md5($unifiedClassPath . '-' . $mappingType); $currentArray = & $this->packageNamespaces; foreach (explode('\\', rtrim($namespace, '\\')) as $namespacePart) { if (!isset($currentArray[$namespacePart])) { $currentArray[$namespacePart] = []; } $currentArray = & $currentArray[$namespacePart]; } if (!isset($currentArray['_pathData'])) { $currentArray['_pathData'] = []; } $currentArray['_pathData'][$entryIdentifier] = [ 'mappingType' => $mappingType, 'path' => $unifiedClassPath ]; }
php
protected function createNamespaceMapEntry(string $namespace, string $classPath, string $mappingType = self::MAPPING_TYPE_PSR0) { $unifiedClassPath = Files::getNormalizedPath($classPath); $entryIdentifier = md5($unifiedClassPath . '-' . $mappingType); $currentArray = & $this->packageNamespaces; foreach (explode('\\', rtrim($namespace, '\\')) as $namespacePart) { if (!isset($currentArray[$namespacePart])) { $currentArray[$namespacePart] = []; } $currentArray = & $currentArray[$namespacePart]; } if (!isset($currentArray['_pathData'])) { $currentArray['_pathData'] = []; } $currentArray['_pathData'][$entryIdentifier] = [ 'mappingType' => $mappingType, 'path' => $unifiedClassPath ]; }
[ "protected", "function", "createNamespaceMapEntry", "(", "string", "$", "namespace", ",", "string", "$", "classPath", ",", "string", "$", "mappingType", "=", "self", "::", "MAPPING_TYPE_PSR0", ")", "{", "$", "unifiedClassPath", "=", "Files", "::", "getNormalizedPa...
Add a namespace to class path mapping to the class loader for resolving classes. @param string $namespace A namespace to map to a class path. @param string $classPath The class path to be mapped. @param string $mappingType The mapping type for this mapping entry. Currently one of self::MAPPING_TYPE_PSR0 or self::MAPPING_TYPE_PSR4 will work. Defaults to self::MAPPING_TYPE_PSR0 @return void
[ "Add", "a", "namespace", "to", "class", "path", "mapping", "to", "the", "class", "loader", "for", "resolving", "classes", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/ClassLoader.php#L221-L241
neos/flow-development-collection
Neos.Flow/Classes/Core/ClassLoader.php
ClassLoader.createFallbackPathEntry
public function createFallbackPathEntry(string $path) { $entryIdentifier = md5($path); if (!isset($this->fallbackClassPaths[$entryIdentifier])) { $this->fallbackClassPaths[$entryIdentifier] = [ 'path' => $path, 'mappingType' => self::MAPPING_TYPE_PSR4 ]; } }
php
public function createFallbackPathEntry(string $path) { $entryIdentifier = md5($path); if (!isset($this->fallbackClassPaths[$entryIdentifier])) { $this->fallbackClassPaths[$entryIdentifier] = [ 'path' => $path, 'mappingType' => self::MAPPING_TYPE_PSR4 ]; } }
[ "public", "function", "createFallbackPathEntry", "(", "string", "$", "path", ")", "{", "$", "entryIdentifier", "=", "md5", "(", "$", "path", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "fallbackClassPaths", "[", "$", "entryIdentifier", "]", ...
Adds an entry to the fallback path map. MappingType for this kind of paths is always PSR4 as no package namespace is used then. @param string $path The fallback path to search in. @return void
[ "Adds", "an", "entry", "to", "the", "fallback", "path", "map", ".", "MappingType", "for", "this", "kind", "of", "paths", "is", "always", "PSR4", "as", "no", "package", "namespace", "is", "used", "then", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/ClassLoader.php#L249-L258
neos/flow-development-collection
Neos.Flow/Classes/Core/ClassLoader.php
ClassLoader.buildClassPathWithPsr0
protected function buildClassPathWithPsr0(array $classNameParts, string $classPath): string { $fileName = implode('/', $classNameParts) . '.php'; return $classPath . $fileName; }
php
protected function buildClassPathWithPsr0(array $classNameParts, string $classPath): string { $fileName = implode('/', $classNameParts) . '.php'; return $classPath . $fileName; }
[ "protected", "function", "buildClassPathWithPsr0", "(", "array", "$", "classNameParts", ",", "string", "$", "classPath", ")", ":", "string", "{", "$", "fileName", "=", "implode", "(", "'/'", ",", "$", "classNameParts", ")", ".", "'.php'", ";", "return", "$",...
Try to build a path to a class according to PSR-0 rules. @param array $classNameParts Parts of the FQ classname. @param string $classPath Already detected class path to a possible package. @return string
[ "Try", "to", "build", "a", "path", "to", "a", "class", "according", "to", "PSR", "-", "0", "rules", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/ClassLoader.php#L299-L304
neos/flow-development-collection
Neos.Flow/Classes/Core/ClassLoader.php
ClassLoader.buildClassPathWithPsr4
protected function buildClassPathWithPsr4(array $classNameParts, string $classPath, int $packageNamespacePartCount): string { $fileName = implode('/', array_slice($classNameParts, $packageNamespacePartCount)) . '.php'; return $classPath . $fileName; }
php
protected function buildClassPathWithPsr4(array $classNameParts, string $classPath, int $packageNamespacePartCount): string { $fileName = implode('/', array_slice($classNameParts, $packageNamespacePartCount)) . '.php'; return $classPath . $fileName; }
[ "protected", "function", "buildClassPathWithPsr4", "(", "array", "$", "classNameParts", ",", "string", "$", "classPath", ",", "int", "$", "packageNamespacePartCount", ")", ":", "string", "{", "$", "fileName", "=", "implode", "(", "'/'", ",", "array_slice", "(", ...
Try to build a path to a class according to PSR-4 rules. @param array $classNameParts Parts of the FQ classname. @param string $classPath Already detected class path to a possible package. @param integer $packageNamespacePartCount Amount of parts of the className that is also part of the package namespace. @return string
[ "Try", "to", "build", "a", "path", "to", "a", "class", "according", "to", "PSR", "-", "4", "rules", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Core/ClassLoader.php#L314-L319
neos/flow-development-collection
Neos.Flow/Classes/Property/TypeConverter/FloatConverter.php
FloatConverter.convertFrom
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { if ($source === null || $source === '') { return null; } elseif (is_string($source) && $configuration instanceof PropertyMappingConfigurationInterface) { $source = $this->parseUsingLocaleIfConfigured($source, $configuration); if ($source instanceof Error) { return $source; } } if (!is_numeric($source)) { return new Error('"%s" cannot be converted to a float value.', 1332934124, [$source]); } return (float)$source; }
php
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) { if ($source === null || $source === '') { return null; } elseif (is_string($source) && $configuration instanceof PropertyMappingConfigurationInterface) { $source = $this->parseUsingLocaleIfConfigured($source, $configuration); if ($source instanceof Error) { return $source; } } if (!is_numeric($source)) { return new Error('"%s" cannot be converted to a float value.', 1332934124, [$source]); } return (float)$source; }
[ "public", "function", "convertFrom", "(", "$", "source", ",", "$", "targetType", ",", "array", "$", "convertedChildProperties", "=", "[", "]", ",", "PropertyMappingConfigurationInterface", "$", "configuration", "=", "null", ")", "{", "if", "(", "$", "source", ...
Actually convert from $source to $targetType, by doing a typecast. @param mixed $source @param string $targetType @param array $convertedChildProperties @param PropertyMappingConfigurationInterface $configuration @return float|\Neos\Error\Messages\Error @api
[ "Actually", "convert", "from", "$source", "to", "$targetType", "by", "doing", "a", "typecast", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Property/TypeConverter/FloatConverter.php#L132-L147
neos/flow-development-collection
Neos.Flow/Classes/Property/TypeConverter/FloatConverter.php
FloatConverter.parseUsingLocaleIfConfigured
protected function parseUsingLocaleIfConfigured($source, PropertyMappingConfigurationInterface $configuration) { $configuration = $this->getConfigurationKeysAndValues($configuration, ['locale', 'strictMode', 'formatLength', 'formatType']); if ($configuration['locale'] === null) { return $source; } elseif ($configuration['locale'] === true) { $locale = $this->localizationService->getConfiguration()->getCurrentLocale(); } elseif (is_string($configuration['locale'])) { $locale = new Locale($configuration['locale']); } elseif ($configuration['locale'] instanceof Locale) { $locale = $configuration['locale']; } if (!($locale instanceof Locale)) { $exceptionMessage = 'Determined locale is not of type "\Neos\Flow\I18n\Locale", but of type "' . (is_object($locale) ? get_class($locale) : gettype($locale)) . '".'; throw new InvalidPropertyMappingConfigurationException($exceptionMessage, 1334837413); } if ($configuration['strictMode'] === null || $configuration['strictMode'] === true) { $strictMode = true; } else { $strictMode = false; } if ($configuration['formatLength'] !== null) { $formatLength = $configuration['formatLength']; NumbersReader::validateFormatLength($formatLength); } else { $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT; } if ($configuration['formatType'] !== null) { $formatType = $configuration['formatType']; NumbersReader::validateFormatType($formatType); } else { $formatType = NumbersReader::FORMAT_TYPE_DECIMAL; } if ($formatType === NumbersReader::FORMAT_TYPE_PERCENT) { $return = $this->numberParser->parsePercentNumber($source, $locale, $formatLength, $strictMode); if ($return === false) { $return = new Error('A valid percent number is expected.', 1334839253); } } else { $return = $this->numberParser->parseDecimalNumber($source, $locale, $formatLength, $strictMode); if ($return === false) { $return = new Error('A valid decimal number is expected.', 1334839260); } } return $return; }
php
protected function parseUsingLocaleIfConfigured($source, PropertyMappingConfigurationInterface $configuration) { $configuration = $this->getConfigurationKeysAndValues($configuration, ['locale', 'strictMode', 'formatLength', 'formatType']); if ($configuration['locale'] === null) { return $source; } elseif ($configuration['locale'] === true) { $locale = $this->localizationService->getConfiguration()->getCurrentLocale(); } elseif (is_string($configuration['locale'])) { $locale = new Locale($configuration['locale']); } elseif ($configuration['locale'] instanceof Locale) { $locale = $configuration['locale']; } if (!($locale instanceof Locale)) { $exceptionMessage = 'Determined locale is not of type "\Neos\Flow\I18n\Locale", but of type "' . (is_object($locale) ? get_class($locale) : gettype($locale)) . '".'; throw new InvalidPropertyMappingConfigurationException($exceptionMessage, 1334837413); } if ($configuration['strictMode'] === null || $configuration['strictMode'] === true) { $strictMode = true; } else { $strictMode = false; } if ($configuration['formatLength'] !== null) { $formatLength = $configuration['formatLength']; NumbersReader::validateFormatLength($formatLength); } else { $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT; } if ($configuration['formatType'] !== null) { $formatType = $configuration['formatType']; NumbersReader::validateFormatType($formatType); } else { $formatType = NumbersReader::FORMAT_TYPE_DECIMAL; } if ($formatType === NumbersReader::FORMAT_TYPE_PERCENT) { $return = $this->numberParser->parsePercentNumber($source, $locale, $formatLength, $strictMode); if ($return === false) { $return = new Error('A valid percent number is expected.', 1334839253); } } else { $return = $this->numberParser->parseDecimalNumber($source, $locale, $formatLength, $strictMode); if ($return === false) { $return = new Error('A valid decimal number is expected.', 1334839260); } } return $return; }
[ "protected", "function", "parseUsingLocaleIfConfigured", "(", "$", "source", ",", "PropertyMappingConfigurationInterface", "$", "configuration", ")", "{", "$", "configuration", "=", "$", "this", "->", "getConfigurationKeysAndValues", "(", "$", "configuration", ",", "[",...
Tries to parse the input using the NumberParser. @param string $source @param PropertyMappingConfigurationInterface $configuration @return float|\Neos\Flow\Validation\Error Parsed float number or error @throws \Neos\Flow\Property\Exception\InvalidPropertyMappingConfigurationException
[ "Tries", "to", "parse", "the", "input", "using", "the", "NumberParser", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Property/TypeConverter/FloatConverter.php#L157-L209
neos/flow-development-collection
Neos.Flow/Classes/Property/TypeConverter/FloatConverter.php
FloatConverter.getConfigurationKeysAndValues
protected function getConfigurationKeysAndValues(PropertyMappingConfigurationInterface $configuration, array $configurationKeys) { $keysAndValues = []; foreach ($configurationKeys as $configurationKey) { $keysAndValues[$configurationKey] = $configuration->getConfigurationValue(FloatConverter::class, $configurationKey); } return $keysAndValues; }
php
protected function getConfigurationKeysAndValues(PropertyMappingConfigurationInterface $configuration, array $configurationKeys) { $keysAndValues = []; foreach ($configurationKeys as $configurationKey) { $keysAndValues[$configurationKey] = $configuration->getConfigurationValue(FloatConverter::class, $configurationKey); } return $keysAndValues; }
[ "protected", "function", "getConfigurationKeysAndValues", "(", "PropertyMappingConfigurationInterface", "$", "configuration", ",", "array", "$", "configurationKeys", ")", "{", "$", "keysAndValues", "=", "[", "]", ";", "foreach", "(", "$", "configurationKeys", "as", "$...
Helper method to collect configuration for this class. @param PropertyMappingConfigurationInterface $configuration @param array $configurationKeys @return array
[ "Helper", "method", "to", "collect", "configuration", "for", "this", "class", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Property/TypeConverter/FloatConverter.php#L218-L225
neos/flow-development-collection
Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php
ProxyClass.getConstructor
public function getConstructor() { if (!isset($this->constructor)) { $this->constructor = new ProxyConstructor($this->fullOriginalClassName); $this->constructor->injectReflectionService($this->reflectionService); } return $this->constructor; }
php
public function getConstructor() { if (!isset($this->constructor)) { $this->constructor = new ProxyConstructor($this->fullOriginalClassName); $this->constructor->injectReflectionService($this->reflectionService); } return $this->constructor; }
[ "public", "function", "getConstructor", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "constructor", ")", ")", "{", "$", "this", "->", "constructor", "=", "new", "ProxyConstructor", "(", "$", "this", "->", "fullOriginalClassName", ")", ...
Returns the ProxyConstructor for this ProxyClass. Creates it if needed. @return ProxyConstructor
[ "Returns", "the", "ProxyConstructor", "for", "this", "ProxyClass", ".", "Creates", "it", "if", "needed", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php#L116-L123
neos/flow-development-collection
Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php
ProxyClass.getMethod
public function getMethod($methodName) { if ($methodName === '__construct') { return $this->getConstructor(); } if (!isset($this->methods[$methodName])) { $this->methods[$methodName] = new ProxyMethod($this->fullOriginalClassName, $methodName); $this->methods[$methodName]->injectReflectionService($this->reflectionService); } return $this->methods[$methodName]; }
php
public function getMethod($methodName) { if ($methodName === '__construct') { return $this->getConstructor(); } if (!isset($this->methods[$methodName])) { $this->methods[$methodName] = new ProxyMethod($this->fullOriginalClassName, $methodName); $this->methods[$methodName]->injectReflectionService($this->reflectionService); } return $this->methods[$methodName]; }
[ "public", "function", "getMethod", "(", "$", "methodName", ")", "{", "if", "(", "$", "methodName", "===", "'__construct'", ")", "{", "return", "$", "this", "->", "getConstructor", "(", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "...
Returns the named ProxyMethod for this ProxyClass. Creates it if needed. @param string $methodName The name of the methods to return @return ProxyMethod
[ "Returns", "the", "named", "ProxyMethod", "for", "this", "ProxyClass", ".", "Creates", "it", "if", "needed", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php#L131-L141
neos/flow-development-collection
Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php
ProxyClass.addProperty
public function addProperty($name, $initialValueCode, $visibility = 'private', $docComment = '') { $this->properties[$name] = [ 'initialValueCode' => $initialValueCode, 'visibility' => $visibility, 'docComment' => $docComment ]; }
php
public function addProperty($name, $initialValueCode, $visibility = 'private', $docComment = '') { $this->properties[$name] = [ 'initialValueCode' => $initialValueCode, 'visibility' => $visibility, 'docComment' => $docComment ]; }
[ "public", "function", "addProperty", "(", "$", "name", ",", "$", "initialValueCode", ",", "$", "visibility", "=", "'private'", ",", "$", "docComment", "=", "''", ")", "{", "$", "this", "->", "properties", "[", "$", "name", "]", "=", "[", "'initialValueCo...
Adds a class property to this proxy class @param string $name Name of the property @param string $initialValueCode PHP code of the initial value assignment @param string $visibility @param string $docComment @return void
[ "Adds", "a", "class", "property", "to", "this", "proxy", "class" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php#L164-L171
neos/flow-development-collection
Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php
ProxyClass.render
public function render() { $namespace = $this->namespace; $proxyClassName = $this->originalClassName; $originalClassName = $this->originalClassName . Compiler::ORIGINAL_CLASSNAME_SUFFIX; $classModifier = ''; if ($this->reflectionService->isClassAbstract($this->fullOriginalClassName)) { $classModifier = 'abstract '; } elseif ($this->reflectionService->isClassFinal($this->fullOriginalClassName)) { $classModifier = 'final '; } $constantsCode = $this->renderConstantsCode(); $propertiesCode = $this->renderPropertiesCode(); $traitsCode = $this->renderTraitsCode(); $methodsCode = isset($this->constructor) ? $this->constructor->render() : ''; foreach ($this->methods as $proxyMethod) { $methodsCode .= $proxyMethod->render(); } if ($methodsCode . $constantsCode === '') { return ''; } $classCode = ($namespace !== '' ? 'namespace ' . $namespace . ";\n\n" : '') . "use Doctrine\\ORM\\Mapping as ORM;\n" . "use Neos\\Flow\\Annotations as Flow;\n" . "\n" . $this->buildClassDocumentation() . $classModifier . 'class ' . $proxyClassName . ' extends ' . $originalClassName . ' implements ' . implode(', ', array_unique($this->interfaces)) . " {\n\n" . $traitsCode . $constantsCode . $propertiesCode . $methodsCode . '}'; return $classCode; }
php
public function render() { $namespace = $this->namespace; $proxyClassName = $this->originalClassName; $originalClassName = $this->originalClassName . Compiler::ORIGINAL_CLASSNAME_SUFFIX; $classModifier = ''; if ($this->reflectionService->isClassAbstract($this->fullOriginalClassName)) { $classModifier = 'abstract '; } elseif ($this->reflectionService->isClassFinal($this->fullOriginalClassName)) { $classModifier = 'final '; } $constantsCode = $this->renderConstantsCode(); $propertiesCode = $this->renderPropertiesCode(); $traitsCode = $this->renderTraitsCode(); $methodsCode = isset($this->constructor) ? $this->constructor->render() : ''; foreach ($this->methods as $proxyMethod) { $methodsCode .= $proxyMethod->render(); } if ($methodsCode . $constantsCode === '') { return ''; } $classCode = ($namespace !== '' ? 'namespace ' . $namespace . ";\n\n" : '') . "use Doctrine\\ORM\\Mapping as ORM;\n" . "use Neos\\Flow\\Annotations as Flow;\n" . "\n" . $this->buildClassDocumentation() . $classModifier . 'class ' . $proxyClassName . ' extends ' . $originalClassName . ' implements ' . implode(', ', array_unique($this->interfaces)) . " {\n\n" . $traitsCode . $constantsCode . $propertiesCode . $methodsCode . '}'; return $classCode; }
[ "public", "function", "render", "(", ")", "{", "$", "namespace", "=", "$", "this", "->", "namespace", ";", "$", "proxyClassName", "=", "$", "this", "->", "originalClassName", ";", "$", "originalClassName", "=", "$", "this", "->", "originalClassName", ".", ...
Renders and returns the PHP code for this ProxyClass. @return string
[ "Renders", "and", "returns", "the", "PHP", "code", "for", "this", "ProxyClass", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php#L206-L242
neos/flow-development-collection
Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php
ProxyClass.buildClassDocumentation
protected function buildClassDocumentation() { $classDocumentation = "/**\n"; $classReflection = new ClassReflection($this->fullOriginalClassName); $classDescription = $classReflection->getDescription(); $classDocumentation .= ' * ' . str_replace("\n", "\n * ", $classDescription) . "\n"; foreach ($this->reflectionService->getClassAnnotations($this->fullOriginalClassName) as $annotation) { $classDocumentation .= ' * ' . Compiler::renderAnnotation($annotation) . "\n"; } $classDocumentation .= " */\n"; return $classDocumentation; }
php
protected function buildClassDocumentation() { $classDocumentation = "/**\n"; $classReflection = new ClassReflection($this->fullOriginalClassName); $classDescription = $classReflection->getDescription(); $classDocumentation .= ' * ' . str_replace("\n", "\n * ", $classDescription) . "\n"; foreach ($this->reflectionService->getClassAnnotations($this->fullOriginalClassName) as $annotation) { $classDocumentation .= ' * ' . Compiler::renderAnnotation($annotation) . "\n"; } $classDocumentation .= " */\n"; return $classDocumentation; }
[ "protected", "function", "buildClassDocumentation", "(", ")", "{", "$", "classDocumentation", "=", "\"/**\\n\"", ";", "$", "classReflection", "=", "new", "ClassReflection", "(", "$", "this", "->", "fullOriginalClassName", ")", ";", "$", "classDescription", "=", "$...
Builds the class documentation block for the specified class keeping doc comments and vital annotations @return string $methodDocumentation DocComment for the given method
[ "Builds", "the", "class", "documentation", "block", "for", "the", "specified", "class", "keeping", "doc", "comments", "and", "vital", "annotations" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php#L249-L263
neos/flow-development-collection
Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php
ProxyClass.renderConstantsCode
protected function renderConstantsCode() { $code = ''; foreach ($this->constants as $name => $valueCode) { $code .= ' const ' . $name . ' = ' . $valueCode . ";\n\n"; } return $code; }
php
protected function renderConstantsCode() { $code = ''; foreach ($this->constants as $name => $valueCode) { $code .= ' const ' . $name . ' = ' . $valueCode . ";\n\n"; } return $code; }
[ "protected", "function", "renderConstantsCode", "(", ")", "{", "$", "code", "=", "''", ";", "foreach", "(", "$", "this", "->", "constants", "as", "$", "name", "=>", "$", "valueCode", ")", "{", "$", "code", ".=", "' const '", ".", "$", "name", ".", ...
Renders code for the added class constants @return string
[ "Renders", "code", "for", "the", "added", "class", "constants" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php#L270-L277
neos/flow-development-collection
Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php
ProxyClass.renderPropertiesCode
protected function renderPropertiesCode() { $code = ''; foreach ($this->properties as $name => $attributes) { if (!empty($attributes['docComment'])) { $code .= ' ' . $attributes['docComment'] . "\n"; } $code .= ' ' . $attributes['visibility'] . ' $' . $name . ' = ' . $attributes['initialValueCode'] . ";\n\n"; } return $code; }
php
protected function renderPropertiesCode() { $code = ''; foreach ($this->properties as $name => $attributes) { if (!empty($attributes['docComment'])) { $code .= ' ' . $attributes['docComment'] . "\n"; } $code .= ' ' . $attributes['visibility'] . ' $' . $name . ' = ' . $attributes['initialValueCode'] . ";\n\n"; } return $code; }
[ "protected", "function", "renderPropertiesCode", "(", ")", "{", "$", "code", "=", "''", ";", "foreach", "(", "$", "this", "->", "properties", "as", "$", "name", "=>", "$", "attributes", ")", "{", "if", "(", "!", "empty", "(", "$", "attributes", "[", ...
Renders code for the added class properties @return string
[ "Renders", "code", "for", "the", "added", "class", "properties" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Proxy/ProxyClass.php#L284-L294
neos/flow-development-collection
Neos.Cache/Classes/Frontend/StringFrontend.php
StringFrontend.getByTag
public function getByTag(string $tag): array { if (!$this->backend instanceof TaggableBackendInterface) { throw new NotSupportedByBackendException('The backend must implement TaggableBackendInterface. Please choose a different cache backend or adjust the code using this cache.', 1483487409); } if (!$this->isValidTag($tag)) { throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1233057772); } $entries = []; $identifiers = $this->backend->findIdentifiersByTag($tag); foreach ($identifiers as $identifier) { $entries[$identifier] = $this->backend->get($identifier); } return $entries; }
php
public function getByTag(string $tag): array { if (!$this->backend instanceof TaggableBackendInterface) { throw new NotSupportedByBackendException('The backend must implement TaggableBackendInterface. Please choose a different cache backend or adjust the code using this cache.', 1483487409); } if (!$this->isValidTag($tag)) { throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1233057772); } $entries = []; $identifiers = $this->backend->findIdentifiersByTag($tag); foreach ($identifiers as $identifier) { $entries[$identifier] = $this->backend->get($identifier); } return $entries; }
[ "public", "function", "getByTag", "(", "string", "$", "tag", ")", ":", "array", "{", "if", "(", "!", "$", "this", "->", "backend", "instanceof", "TaggableBackendInterface", ")", "{", "throw", "new", "NotSupportedByBackendException", "(", "'The backend must impleme...
Finds and returns all cache entries which are tagged by the specified tag. @param string $tag The tag to search for @return array An array with the identifier (key) and content (value) of all matching entries. An empty array if no entries matched @throws NotSupportedByBackendException @throws \InvalidArgumentException @api
[ "Finds", "and", "returns", "all", "cache", "entries", "which", "are", "tagged", "by", "the", "specified", "tag", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Frontend/StringFrontend.php#L81-L96
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.parseDatetimeWithCustomPattern
public function parseDatetimeWithCustomPattern($datetimeToParse, $format, I18n\Locale $locale, $strictMode = true) { return $this->doParsingWithParsedFormat($datetimeToParse, $this->datesReader->parseCustomFormat($format), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
php
public function parseDatetimeWithCustomPattern($datetimeToParse, $format, I18n\Locale $locale, $strictMode = true) { return $this->doParsingWithParsedFormat($datetimeToParse, $this->datesReader->parseCustomFormat($format), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
[ "public", "function", "parseDatetimeWithCustomPattern", "(", "$", "datetimeToParse", ",", "$", "format", ",", "I18n", "\\", "Locale", "$", "locale", ",", "$", "strictMode", "=", "true", ")", "{", "return", "$", "this", "->", "doParsingWithParsedFormat", "(", "...
Returns dateTime parsed by custom format (string provided in parameter). Format must obey syntax defined in CLDR specification, excluding unimplemented features (see documentation for DatesReader class). Format is remembered in cache and won't be parsed again for some time. @param string $datetimeToParse Date/time to be parsed @param string $format Format string @param I18n\Locale $locale A locale used for finding literals array @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Array of parsed date / time elements, false on failure @api @see DatesReader
[ "Returns", "dateTime", "parsed", "by", "custom", "format", "(", "string", "provided", "in", "parameter", ")", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L71-L74
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.parseDate
public function parseDate($dateToParse, I18n\Locale $locale, $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { DatesReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($dateToParse, $this->datesReader->parseFormatFromCldr($locale, DatesReader::FORMAT_TYPE_DATE, $formatLength), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
php
public function parseDate($dateToParse, I18n\Locale $locale, $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { DatesReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($dateToParse, $this->datesReader->parseFormatFromCldr($locale, DatesReader::FORMAT_TYPE_DATE, $formatLength), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
[ "public", "function", "parseDate", "(", "$", "dateToParse", ",", "I18n", "\\", "Locale", "$", "locale", ",", "$", "formatLength", "=", "DatesReader", "::", "FORMAT_LENGTH_DEFAULT", ",", "$", "strictMode", "=", "true", ")", "{", "DatesReader", "::", "validateFo...
Parses date with format string for date defined in CLDR for particular locale. @param string $dateToParse date to be parsed @param I18n\Locale $locale @param string $formatLength One of: full, long, medium, short, or 'default' in order to use default length from CLDR @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Array of parsed date elements, false on failure @api
[ "Parses", "date", "with", "format", "string", "for", "date", "defined", "in", "CLDR", "for", "particular", "locale", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L87-L91
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.parseTime
public function parseTime($timeToParse, I18n\Locale $locale, $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { DatesReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($timeToParse, $this->datesReader->parseFormatFromCldr($locale, DatesReader::FORMAT_TYPE_TIME, $formatLength), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
php
public function parseTime($timeToParse, I18n\Locale $locale, $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { DatesReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($timeToParse, $this->datesReader->parseFormatFromCldr($locale, DatesReader::FORMAT_TYPE_TIME, $formatLength), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
[ "public", "function", "parseTime", "(", "$", "timeToParse", ",", "I18n", "\\", "Locale", "$", "locale", ",", "$", "formatLength", "=", "DatesReader", "::", "FORMAT_LENGTH_DEFAULT", ",", "$", "strictMode", "=", "true", ")", "{", "DatesReader", "::", "validateFo...
Parses time with format string for time defined in CLDR for particular locale. @param string $timeToParse Time to be parsed @param I18n\Locale $locale @param string $formatLength One of: full, long, medium, short, or 'default' in order to use default length from CLDR @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Array of parsed time elements, false on failure @api
[ "Parses", "time", "with", "format", "string", "for", "time", "defined", "in", "CLDR", "for", "particular", "locale", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L104-L108
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.parseDateAndTime
public function parseDateAndTime($dateAndTimeToParse, I18n\Locale $locale, $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { DatesReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($dateAndTimeToParse, $this->datesReader->parseFormatFromCldr($locale, DatesReader::FORMAT_TYPE_DATETIME, $formatLength), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
php
public function parseDateAndTime($dateAndTimeToParse, I18n\Locale $locale, $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT, $strictMode = true) { DatesReader::validateFormatLength($formatLength); return $this->doParsingWithParsedFormat($dateAndTimeToParse, $this->datesReader->parseFormatFromCldr($locale, DatesReader::FORMAT_TYPE_DATETIME, $formatLength), $this->datesReader->getLocalizedLiteralsForLocale($locale), $strictMode); }
[ "public", "function", "parseDateAndTime", "(", "$", "dateAndTimeToParse", ",", "I18n", "\\", "Locale", "$", "locale", ",", "$", "formatLength", "=", "DatesReader", "::", "FORMAT_LENGTH_DEFAULT", ",", "$", "strictMode", "=", "true", ")", "{", "DatesReader", "::",...
Parses dateTime with format string for date and time defined in CLDR for particular locale. @param string $dateAndTimeToParse Date and time to be parsed @param I18n\Locale $locale @param string $formatLength One of: full, long, medium, short, or 'default' in order to use default length from CLDR @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Array of parsed date and time elements, false on failure
[ "Parses", "dateTime", "with", "format", "string", "for", "date", "and", "time", "defined", "in", "CLDR", "for", "particular", "locale", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L120-L124
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.doParsingWithParsedFormat
protected function doParsingWithParsedFormat($datetimeToParse, array $parsedFormat, array $localizedLiterals, $strictMode) { return ($strictMode) ? $this->doParsingInStrictMode($datetimeToParse, $parsedFormat, $localizedLiterals) : $this->doParsingInLenientMode($datetimeToParse, $parsedFormat, $localizedLiterals); }
php
protected function doParsingWithParsedFormat($datetimeToParse, array $parsedFormat, array $localizedLiterals, $strictMode) { return ($strictMode) ? $this->doParsingInStrictMode($datetimeToParse, $parsedFormat, $localizedLiterals) : $this->doParsingInLenientMode($datetimeToParse, $parsedFormat, $localizedLiterals); }
[ "protected", "function", "doParsingWithParsedFormat", "(", "$", "datetimeToParse", ",", "array", "$", "parsedFormat", ",", "array", "$", "localizedLiterals", ",", "$", "strictMode", ")", "{", "return", "(", "$", "strictMode", ")", "?", "$", "this", "->", "doPa...
Parses date and / or time using parsed format, in strict or lenient mode. @param string $datetimeToParse Date/time to be parsed @param array $parsedFormat Parsed format (from DatesReader) @param array $localizedLiterals Array of date / time literals from CLDR @param boolean $strictMode Work mode (strict when true, lenient when false) @return mixed Array of parsed date and / or time elements, false on failure
[ "Parses", "date", "and", "/", "or", "time", "using", "parsed", "format", "in", "strict", "or", "lenient", "mode", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L135-L138
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.doParsingInStrictMode
protected function doParsingInStrictMode($datetimeToParse, array $parsedFormat, array $localizedLiterals) { $datetimeElements = [ 'year' => null, 'month' => null, 'day' => null, 'hour' => null, 'minute' => null, 'second' => null, 'timezone' => null, ]; $using12HourClock = false; $timeIsPm = false; try { foreach ($parsedFormat as $subformat) { if (is_array($subformat)) { // This is literal string, should match exactly if (I18n\Utility::stringBeginsWith($datetimeToParse, $subformat[0])) { $datetimeToParse = substr_replace($datetimeToParse, '', 0, strlen($subformat[0])); continue; } else { return false; } } $lengthOfSubformat = strlen($subformat); $numberOfCharactersToRemove = 0; switch ($subformat[0]) { case 'h': case 'K': $hour = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 1, 12); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $hour < 10) ? 1 : 2; if ($subformat[0] === 'h' && $hour === 12) { $hour = 0; } $datetimeElements['hour'] = $hour; $using12HourClock = true; break; case 'k': case 'H': $hour = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 1, 24); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $hour < 10) ? 1 : 2; if ($subformat[0] === 'k' && $hour === 24) { $hour = 0; } $datetimeElements['hour'] = $hour; break; case 'a': $dayPeriods = $localizedLiterals['dayPeriods']['format']['wide']; if (I18n\Utility::stringBeginsWith($datetimeToParse, $dayPeriods['am'])) { $numberOfCharactersToRemove = strlen($dayPeriods['am']); } elseif (I18n\Utility::stringBeginsWith($datetimeToParse, $dayPeriods['pm'])) { $timeIsPm = true; $numberOfCharactersToRemove = strlen($dayPeriods['pm']); } else { return false; } break; case 'm': $minute = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 0, 59); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $minute < 10) ? 1 : 2; $datetimeElements['minute'] = $minute; break; case 's': $second = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 0, 59); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $second < 10) ? 1 : 2; $datetimeElements['second'] = $second; break; case 'd': $dayOfTheMonth = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 1, 31); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $dayOfTheMonth < 10) ? 1 : 2; $datetimeElements['day'] = $dayOfTheMonth; break; case 'M': case 'L': $typeOfLiteral = ($subformat[0] === 'L') ? 'stand-alone' : 'format'; if ($lengthOfSubformat <= 2) { $month = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 1, 12); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $month < 10) ? 1 : 2; } elseif ($lengthOfSubformat <= 4) { $lengthOfLiteral = ($lengthOfSubformat === 3) ? 'abbreviated' : 'wide'; $month = 0; foreach ($localizedLiterals['months'][$typeOfLiteral][$lengthOfLiteral] as $monthId => $monthName) { if (I18n\Utility::stringBeginsWith($datetimeToParse, $monthName)) { $month = $monthId; break; } } } else { throw new InvalidArgumentException('Cannot parse formats with narrow month pattern as it is not unique.', 1279965245); } if ($month === 0) { return false; } $datetimeElements['month'] = $month; break; case 'y': if ($lengthOfSubformat === 2) { /** @todo How should the XX date be returned? Like 19XX? **/ $year = substr($datetimeToParse, 0, 2); $numberOfCharactersToRemove = 2; } else { $year = substr($datetimeToParse, 0, $lengthOfSubformat); $datetimeToParseLength = strlen($datetimeToParse); for ($i = $lengthOfSubformat; $i < $datetimeToParseLength; ++$i) { if (is_numeric($datetimeToParse[$i])) { $year .= $datetimeToParse[$i]; } else { break; } } $numberOfCharactersToRemove = $i; } if (!is_numeric($year)) { return false; } $year = (int)$year; $datetimeElements['year'] = $year; break; case 'v': case 'z': if ($lengthOfSubformat <= 3) { $pattern = self::PATTERN_MATCH_STRICT_TIMEZONE_ABBREVIATION; } else { $pattern = self::PATTERN_MATCH_STRICT_TIMEZONE_TZ; } if (preg_match($pattern, $datetimeToParse, $matches) !== 1) { return false; } $datetimeElements['timezone'] = $matches[0]; break; case 'D': case 'F': case 'w': case 'W': case 'Q': case 'q': case 'G': case 'S': case 'E': case 'Y': case 'u': case 'l': case 'g': case 'e': case 'c': case 'A': case 'Z': case 'V': // Silently ignore unsupported formats or formats that there is no need to parse break; default: throw new InvalidArgumentException('Unexpected format symbol, "' . $subformat[0] . '" detected for date / time parsing.', 1279965528); } if ($using12HourClock && $timeIsPm) { $datetimeElements['hour'] += 12; $timeIsPm = false; } if ($numberOfCharactersToRemove > 0) { $datetimeToParse = substr_replace($datetimeToParse, '', 0, $numberOfCharactersToRemove); } } } catch (Exception\InvalidParseStringException $exception) { // Method extractAndCheckNumber() throws exception when constraints in $datetimeToParse are not fulfilled return false; } return $datetimeElements; }
php
protected function doParsingInStrictMode($datetimeToParse, array $parsedFormat, array $localizedLiterals) { $datetimeElements = [ 'year' => null, 'month' => null, 'day' => null, 'hour' => null, 'minute' => null, 'second' => null, 'timezone' => null, ]; $using12HourClock = false; $timeIsPm = false; try { foreach ($parsedFormat as $subformat) { if (is_array($subformat)) { // This is literal string, should match exactly if (I18n\Utility::stringBeginsWith($datetimeToParse, $subformat[0])) { $datetimeToParse = substr_replace($datetimeToParse, '', 0, strlen($subformat[0])); continue; } else { return false; } } $lengthOfSubformat = strlen($subformat); $numberOfCharactersToRemove = 0; switch ($subformat[0]) { case 'h': case 'K': $hour = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 1, 12); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $hour < 10) ? 1 : 2; if ($subformat[0] === 'h' && $hour === 12) { $hour = 0; } $datetimeElements['hour'] = $hour; $using12HourClock = true; break; case 'k': case 'H': $hour = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 1, 24); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $hour < 10) ? 1 : 2; if ($subformat[0] === 'k' && $hour === 24) { $hour = 0; } $datetimeElements['hour'] = $hour; break; case 'a': $dayPeriods = $localizedLiterals['dayPeriods']['format']['wide']; if (I18n\Utility::stringBeginsWith($datetimeToParse, $dayPeriods['am'])) { $numberOfCharactersToRemove = strlen($dayPeriods['am']); } elseif (I18n\Utility::stringBeginsWith($datetimeToParse, $dayPeriods['pm'])) { $timeIsPm = true; $numberOfCharactersToRemove = strlen($dayPeriods['pm']); } else { return false; } break; case 'm': $minute = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 0, 59); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $minute < 10) ? 1 : 2; $datetimeElements['minute'] = $minute; break; case 's': $second = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 0, 59); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $second < 10) ? 1 : 2; $datetimeElements['second'] = $second; break; case 'd': $dayOfTheMonth = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 1, 31); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $dayOfTheMonth < 10) ? 1 : 2; $datetimeElements['day'] = $dayOfTheMonth; break; case 'M': case 'L': $typeOfLiteral = ($subformat[0] === 'L') ? 'stand-alone' : 'format'; if ($lengthOfSubformat <= 2) { $month = $this->extractAndCheckNumber($datetimeToParse, ($lengthOfSubformat === 2), 1, 12); $numberOfCharactersToRemove = ($lengthOfSubformat === 1 && $month < 10) ? 1 : 2; } elseif ($lengthOfSubformat <= 4) { $lengthOfLiteral = ($lengthOfSubformat === 3) ? 'abbreviated' : 'wide'; $month = 0; foreach ($localizedLiterals['months'][$typeOfLiteral][$lengthOfLiteral] as $monthId => $monthName) { if (I18n\Utility::stringBeginsWith($datetimeToParse, $monthName)) { $month = $monthId; break; } } } else { throw new InvalidArgumentException('Cannot parse formats with narrow month pattern as it is not unique.', 1279965245); } if ($month === 0) { return false; } $datetimeElements['month'] = $month; break; case 'y': if ($lengthOfSubformat === 2) { /** @todo How should the XX date be returned? Like 19XX? **/ $year = substr($datetimeToParse, 0, 2); $numberOfCharactersToRemove = 2; } else { $year = substr($datetimeToParse, 0, $lengthOfSubformat); $datetimeToParseLength = strlen($datetimeToParse); for ($i = $lengthOfSubformat; $i < $datetimeToParseLength; ++$i) { if (is_numeric($datetimeToParse[$i])) { $year .= $datetimeToParse[$i]; } else { break; } } $numberOfCharactersToRemove = $i; } if (!is_numeric($year)) { return false; } $year = (int)$year; $datetimeElements['year'] = $year; break; case 'v': case 'z': if ($lengthOfSubformat <= 3) { $pattern = self::PATTERN_MATCH_STRICT_TIMEZONE_ABBREVIATION; } else { $pattern = self::PATTERN_MATCH_STRICT_TIMEZONE_TZ; } if (preg_match($pattern, $datetimeToParse, $matches) !== 1) { return false; } $datetimeElements['timezone'] = $matches[0]; break; case 'D': case 'F': case 'w': case 'W': case 'Q': case 'q': case 'G': case 'S': case 'E': case 'Y': case 'u': case 'l': case 'g': case 'e': case 'c': case 'A': case 'Z': case 'V': // Silently ignore unsupported formats or formats that there is no need to parse break; default: throw new InvalidArgumentException('Unexpected format symbol, "' . $subformat[0] . '" detected for date / time parsing.', 1279965528); } if ($using12HourClock && $timeIsPm) { $datetimeElements['hour'] += 12; $timeIsPm = false; } if ($numberOfCharactersToRemove > 0) { $datetimeToParse = substr_replace($datetimeToParse, '', 0, $numberOfCharactersToRemove); } } } catch (Exception\InvalidParseStringException $exception) { // Method extractAndCheckNumber() throws exception when constraints in $datetimeToParse are not fulfilled return false; } return $datetimeElements; }
[ "protected", "function", "doParsingInStrictMode", "(", "$", "datetimeToParse", ",", "array", "$", "parsedFormat", ",", "array", "$", "localizedLiterals", ")", "{", "$", "datetimeElements", "=", "[", "'year'", "=>", "null", ",", "'month'", "=>", "null", ",", "'...
Parses date and / or time in strict mode. @param string $datetimeToParse Date/time to be parsed @param array $parsedFormat Format parsed by DatesReader @param array $localizedLiterals Array of date / time literals from CLDR @return array Array of parsed date and / or time elements, false on failure @throws InvalidArgumentException When unexpected symbol found in format @see DatesReader
[ "Parses", "date", "and", "/", "or", "time", "in", "strict", "mode", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L150-L331
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.doParsingInLenientMode
protected function doParsingInLenientMode($datetimeToParse, array $parsedFormat, array $localizedLiterals) { $datetimeElements = [ 'year' => null, 'month' => null, 'day' => null, 'hour' => null, 'minute' => null, 'second' => null, 'timezone' => null, ]; $using12HourClock = false; $timeIsPm = false; foreach ($parsedFormat as $subformat) { try { if (is_array($subformat)) { // This is literal string, and we ignore them continue; } $lengthOfSubformat = strlen($subformat); $numberOfCharactersToRemove = 0; $position = 0; switch ($subformat[0]) { case 'K': $hour = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($hour >= 0 && $hour <= 11) { $numberOfCharactersToRemove = $position + strlen($hour); $datetimeElements['hour'] = (int)$hour; $using12HourClock = true; break; } case 'h': if (!isset($hour)) { $hour = $this->extractNumberAndGetPosition($datetimeToParse, $position); } if ($hour >= 1 && $hour <= 12) { $numberOfCharactersToRemove = $position + strlen($hour); if ((int)$hour === 12) { $hour = 0; } $datetimeElements['hour'] = (int)$hour; $using12HourClock = true; break; } case 'H': if (!isset($hour)) { $hour = $this->extractNumberAndGetPosition($datetimeToParse, $position); } if ($hour >= 0 && $hour <= 23) { $numberOfCharactersToRemove = $position + strlen($hour); $datetimeElements['hour'] = (int)$hour; break; } case 'k': if (!isset($hour)) { $hour = $this->extractNumberAndGetPosition($datetimeToParse, $position); } if ($hour >= 1 && $hour <= 24) { $numberOfCharactersToRemove = $position + strlen($hour); if ((int)$hour === 24) { $hour = 0; } $datetimeElements['hour'] = (int)$hour; break; } else { throw new Exception\InvalidParseStringException('Unable to match number string to any hour format.', 1280488645); } case 'a': $dayPeriods = $localizedLiterals['dayPeriods']['format']['wide']; $positionOfDayPeriod = strpos($datetimeToParse, $dayPeriods['am']); if ($positionOfDayPeriod !== false) { $numberOfCharactersToRemove = $positionOfDayPeriod + strlen($dayPeriods['am']); } else { $positionOfDayPeriod = strpos($datetimeToParse, $dayPeriods['pm']); if ($positionOfDayPeriod !== false) { $numberOfCharactersToRemove = $positionOfDayPeriod + strlen($dayPeriods['pm']); $timeIsPm = true; } else { throw new Exception\InvalidParseStringException('Unable to match any day period.', 1280489183); } } break; case 'm': $minute = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($minute < 0 && $minute > 59) { throw new Exception\InvalidParseStringException('Expected minute is out of range.', 1280489411); } $numberOfCharactersToRemove = $position + strlen($minute); $datetimeElements['minute'] = (int)$minute; break; case 's': $second = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($second < 0 && $second > 59) { throw new Exception\InvalidParseStringException('Expected second is out of range.', 1280489412); } $numberOfCharactersToRemove = $position + strlen($second); $datetimeElements['second'] = (int)$second; break; case 'd': $day = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($day < 1 && $day > 31) { throw new Exception\InvalidParseStringException('Expected day is out of range.', 1280489413); } $numberOfCharactersToRemove = $position + strlen($day); $datetimeElements['day'] = (int)$day; break; case 'M': case 'L': $typeOfLiteral = ($subformat[0] === 'L') ? 'stand-alone' : 'format'; switch ($lengthOfSubformat) { case 1: case 2: try { $month = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($month >= 1 && $month <= 31) { $numberOfCharactersToRemove = $position + strlen($month); $datetimeElements['month'] = (int)$month; break; } } catch (Exception\InvalidParseStringException $exception) { // Try to match month's name by cases below } case 3: foreach ($localizedLiterals['months'][$typeOfLiteral]['abbreviated'] as $monthId => $monthName) { $positionOfMonthName = strpos($datetimeToParse, $monthName); if ($positionOfMonthName !== false) { $numberOfCharactersToRemove = $positionOfMonthName + strlen($monthName); $datetimeElements['month'] = (int)$monthId; break; } } if ($datetimeElements['month'] !== null) { break; } case 4: foreach ($localizedLiterals['months'][$typeOfLiteral]['wide'] as $monthId => $monthName) { $positionOfMonthName = strpos($datetimeToParse, $monthName); if ($positionOfMonthName !== false) { $numberOfCharactersToRemove = $positionOfMonthName + strlen($monthName); $datetimeElements['month'] = (int)$monthId; break; } } if ($datetimeElements['month'] === null) { throw new Exception\InvalidParseStringException('Neither month name or number were matched.', 1280497950); } default: throw new InvalidArgumentException('Cannot parse formats with narrow month pattern as it is not unique.', 1280495827); } break; case 'y': $year = $this->extractNumberAndGetPosition($datetimeToParse, $position); $numberOfCharactersToRemove = $position + strlen($year); /** @todo Two digits date (like 99) shoud be handled here somehow **/ $datetimeElements['year'] = (int)$year; break; case 'v': case 'z': if ($lengthOfSubformat <= 3) { $firstPattern = self::PATTERN_MATCH_LENIENT_TIMEZONE_ABBREVIATION; $secondPattern = self::PATTERN_MATCH_LENIENT_TIMEZONE_TZ; } else { $firstPattern = self::PATTERN_MATCH_LENIENT_TIMEZONE_TZ; $secondPattern = self::PATTERN_MATCH_LENIENT_TIMEZONE_ABBREVIATION; } if (preg_match($firstPattern, $datetimeToParse, $matches) === 0) { if (preg_match($secondPattern, $datetimeToParse, $matches) === 0) { throw new Exception\InvalidParseStringException('Expected timezone identifier was not found.', 1280492312); } } $timezone = $matches[0]; $numberOfCharactersToRemove = strpos($datetimeToParse, $timezone) + strlen($timezone); $datetimeElements['timezone'] = $matches[0]; break; case 'D': case 'F': case 'w': case 'W': case 'Q': case 'q': case 'G': case 'S': case 'E': case 'Y': case 'u': case 'l': case 'g': case 'e': case 'c': case 'A': case 'Z': case 'V': // Silently ignore unsupported formats or formats that there is no need to parse break; default: throw new InvalidArgumentException('Unexpected format symbol, "' . $subformat[0] . '" detected for date / time parsing.', 1279965529); } if ($using12HourClock && $timeIsPm) { $datetimeElements['hour'] += 12; $timeIsPm = false; } if ($numberOfCharactersToRemove > 0) { $datetimeToParse = substr_replace($datetimeToParse, '', 0, $numberOfCharactersToRemove); } } catch (Exception\InvalidParseStringException $exception) { // Matching failed, but in lenient mode we ignore it and try to match next element continue; } } return $datetimeElements; }
php
protected function doParsingInLenientMode($datetimeToParse, array $parsedFormat, array $localizedLiterals) { $datetimeElements = [ 'year' => null, 'month' => null, 'day' => null, 'hour' => null, 'minute' => null, 'second' => null, 'timezone' => null, ]; $using12HourClock = false; $timeIsPm = false; foreach ($parsedFormat as $subformat) { try { if (is_array($subformat)) { // This is literal string, and we ignore them continue; } $lengthOfSubformat = strlen($subformat); $numberOfCharactersToRemove = 0; $position = 0; switch ($subformat[0]) { case 'K': $hour = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($hour >= 0 && $hour <= 11) { $numberOfCharactersToRemove = $position + strlen($hour); $datetimeElements['hour'] = (int)$hour; $using12HourClock = true; break; } case 'h': if (!isset($hour)) { $hour = $this->extractNumberAndGetPosition($datetimeToParse, $position); } if ($hour >= 1 && $hour <= 12) { $numberOfCharactersToRemove = $position + strlen($hour); if ((int)$hour === 12) { $hour = 0; } $datetimeElements['hour'] = (int)$hour; $using12HourClock = true; break; } case 'H': if (!isset($hour)) { $hour = $this->extractNumberAndGetPosition($datetimeToParse, $position); } if ($hour >= 0 && $hour <= 23) { $numberOfCharactersToRemove = $position + strlen($hour); $datetimeElements['hour'] = (int)$hour; break; } case 'k': if (!isset($hour)) { $hour = $this->extractNumberAndGetPosition($datetimeToParse, $position); } if ($hour >= 1 && $hour <= 24) { $numberOfCharactersToRemove = $position + strlen($hour); if ((int)$hour === 24) { $hour = 0; } $datetimeElements['hour'] = (int)$hour; break; } else { throw new Exception\InvalidParseStringException('Unable to match number string to any hour format.', 1280488645); } case 'a': $dayPeriods = $localizedLiterals['dayPeriods']['format']['wide']; $positionOfDayPeriod = strpos($datetimeToParse, $dayPeriods['am']); if ($positionOfDayPeriod !== false) { $numberOfCharactersToRemove = $positionOfDayPeriod + strlen($dayPeriods['am']); } else { $positionOfDayPeriod = strpos($datetimeToParse, $dayPeriods['pm']); if ($positionOfDayPeriod !== false) { $numberOfCharactersToRemove = $positionOfDayPeriod + strlen($dayPeriods['pm']); $timeIsPm = true; } else { throw new Exception\InvalidParseStringException('Unable to match any day period.', 1280489183); } } break; case 'm': $minute = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($minute < 0 && $minute > 59) { throw new Exception\InvalidParseStringException('Expected minute is out of range.', 1280489411); } $numberOfCharactersToRemove = $position + strlen($minute); $datetimeElements['minute'] = (int)$minute; break; case 's': $second = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($second < 0 && $second > 59) { throw new Exception\InvalidParseStringException('Expected second is out of range.', 1280489412); } $numberOfCharactersToRemove = $position + strlen($second); $datetimeElements['second'] = (int)$second; break; case 'd': $day = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($day < 1 && $day > 31) { throw new Exception\InvalidParseStringException('Expected day is out of range.', 1280489413); } $numberOfCharactersToRemove = $position + strlen($day); $datetimeElements['day'] = (int)$day; break; case 'M': case 'L': $typeOfLiteral = ($subformat[0] === 'L') ? 'stand-alone' : 'format'; switch ($lengthOfSubformat) { case 1: case 2: try { $month = $this->extractNumberAndGetPosition($datetimeToParse, $position); if ($month >= 1 && $month <= 31) { $numberOfCharactersToRemove = $position + strlen($month); $datetimeElements['month'] = (int)$month; break; } } catch (Exception\InvalidParseStringException $exception) { // Try to match month's name by cases below } case 3: foreach ($localizedLiterals['months'][$typeOfLiteral]['abbreviated'] as $monthId => $monthName) { $positionOfMonthName = strpos($datetimeToParse, $monthName); if ($positionOfMonthName !== false) { $numberOfCharactersToRemove = $positionOfMonthName + strlen($monthName); $datetimeElements['month'] = (int)$monthId; break; } } if ($datetimeElements['month'] !== null) { break; } case 4: foreach ($localizedLiterals['months'][$typeOfLiteral]['wide'] as $monthId => $monthName) { $positionOfMonthName = strpos($datetimeToParse, $monthName); if ($positionOfMonthName !== false) { $numberOfCharactersToRemove = $positionOfMonthName + strlen($monthName); $datetimeElements['month'] = (int)$monthId; break; } } if ($datetimeElements['month'] === null) { throw new Exception\InvalidParseStringException('Neither month name or number were matched.', 1280497950); } default: throw new InvalidArgumentException('Cannot parse formats with narrow month pattern as it is not unique.', 1280495827); } break; case 'y': $year = $this->extractNumberAndGetPosition($datetimeToParse, $position); $numberOfCharactersToRemove = $position + strlen($year); /** @todo Two digits date (like 99) shoud be handled here somehow **/ $datetimeElements['year'] = (int)$year; break; case 'v': case 'z': if ($lengthOfSubformat <= 3) { $firstPattern = self::PATTERN_MATCH_LENIENT_TIMEZONE_ABBREVIATION; $secondPattern = self::PATTERN_MATCH_LENIENT_TIMEZONE_TZ; } else { $firstPattern = self::PATTERN_MATCH_LENIENT_TIMEZONE_TZ; $secondPattern = self::PATTERN_MATCH_LENIENT_TIMEZONE_ABBREVIATION; } if (preg_match($firstPattern, $datetimeToParse, $matches) === 0) { if (preg_match($secondPattern, $datetimeToParse, $matches) === 0) { throw new Exception\InvalidParseStringException('Expected timezone identifier was not found.', 1280492312); } } $timezone = $matches[0]; $numberOfCharactersToRemove = strpos($datetimeToParse, $timezone) + strlen($timezone); $datetimeElements['timezone'] = $matches[0]; break; case 'D': case 'F': case 'w': case 'W': case 'Q': case 'q': case 'G': case 'S': case 'E': case 'Y': case 'u': case 'l': case 'g': case 'e': case 'c': case 'A': case 'Z': case 'V': // Silently ignore unsupported formats or formats that there is no need to parse break; default: throw new InvalidArgumentException('Unexpected format symbol, "' . $subformat[0] . '" detected for date / time parsing.', 1279965529); } if ($using12HourClock && $timeIsPm) { $datetimeElements['hour'] += 12; $timeIsPm = false; } if ($numberOfCharactersToRemove > 0) { $datetimeToParse = substr_replace($datetimeToParse, '', 0, $numberOfCharactersToRemove); } } catch (Exception\InvalidParseStringException $exception) { // Matching failed, but in lenient mode we ignore it and try to match next element continue; } } return $datetimeElements; }
[ "protected", "function", "doParsingInLenientMode", "(", "$", "datetimeToParse", ",", "array", "$", "parsedFormat", ",", "array", "$", "localizedLiterals", ")", "{", "$", "datetimeElements", "=", "[", "'year'", "=>", "null", ",", "'month'", "=>", "null", ",", "...
Parses date and / or time in lenient mode. Algorithm assumptions: - ignore all literals - order of elements in parsed format is important - length of subformat is not strictly checked (eg. 'h' and 'hh') - number must be in range in order to be accepted (eg. 1-12 for month) - some format fallback substitutions can be done (eg. 'Jan' for 'January') @param string $datetimeToParse Date/time to be parsed @param array $parsedFormat Format parsed by DatesReader @param array $localizedLiterals Array of date / time literals from CLDR @return array Array of parsed date and / or time elements (can be array of NULLs if nothing was parsed) @throws Exception\InvalidParseStringException @throws InvalidArgumentException When unexpected symbol found in format @see DatesReader
[ "Parses", "date", "and", "/", "or", "time", "in", "lenient", "mode", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L351-L573
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.extractAndCheckNumber
protected function extractAndCheckNumber($datetimeToParse, $isTwoDigits, $minValue, $maxValue) { if ($isTwoDigits || is_numeric($datetimeToParse[1])) { $number = substr($datetimeToParse, 0, 2); } else { $number = $datetimeToParse[0]; } if (is_numeric($number)) { $number = (int)$number; if ($number <= $maxValue || $number >= $minValue) { return $number; } } throw new Exception\InvalidParseStringException('Expected one or two-digit number not found at the beginning of the string.', 1279963654); }
php
protected function extractAndCheckNumber($datetimeToParse, $isTwoDigits, $minValue, $maxValue) { if ($isTwoDigits || is_numeric($datetimeToParse[1])) { $number = substr($datetimeToParse, 0, 2); } else { $number = $datetimeToParse[0]; } if (is_numeric($number)) { $number = (int)$number; if ($number <= $maxValue || $number >= $minValue) { return $number; } } throw new Exception\InvalidParseStringException('Expected one or two-digit number not found at the beginning of the string.', 1279963654); }
[ "protected", "function", "extractAndCheckNumber", "(", "$", "datetimeToParse", ",", "$", "isTwoDigits", ",", "$", "minValue", ",", "$", "maxValue", ")", "{", "if", "(", "$", "isTwoDigits", "||", "is_numeric", "(", "$", "datetimeToParse", "[", "1", "]", ")", ...
Extracts one or two-digit number from the beginning of the string. If the number has certainly two digits, $isTwoDigits can be set to true so no additional checking is done (this implies from some date/time formats, like 'hh'). Number is also checked for constraints: minimum and maximum value. @param string $datetimeToParse Date/time to be parsed @param boolean $isTwoDigits true if number has surely two digits, false if it has one or two digits @param int $minValue @param int $maxValue @return int Parsed number @throws Exception\InvalidParseStringException When string cannot be parsed or number does not conforms constraints
[ "Extracts", "one", "or", "two", "-", "digit", "number", "from", "the", "beginning", "of", "the", "string", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L591-L608
neos/flow-development-collection
Neos.Flow/Classes/I18n/Parser/DatetimeParser.php
DatetimeParser.extractNumberAndGetPosition
protected function extractNumberAndGetPosition($datetimeToParse, &$position) { $characters = str_split($datetimeToParse); $number = ''; $numberStarted = false; foreach ($characters as $index => $character) { if (ord($character) >= 48 && ord($character) <= 57) { if (!$numberStarted) { $numberStarted = true; $position = $index; } $number .= $character; } elseif ($numberStarted) { return $number; } } if ($numberStarted) { return $number; } throw new Exception\InvalidParseStringException('Expected number not found in the string.', 1280498431); }
php
protected function extractNumberAndGetPosition($datetimeToParse, &$position) { $characters = str_split($datetimeToParse); $number = ''; $numberStarted = false; foreach ($characters as $index => $character) { if (ord($character) >= 48 && ord($character) <= 57) { if (!$numberStarted) { $numberStarted = true; $position = $index; } $number .= $character; } elseif ($numberStarted) { return $number; } } if ($numberStarted) { return $number; } throw new Exception\InvalidParseStringException('Expected number not found in the string.', 1280498431); }
[ "protected", "function", "extractNumberAndGetPosition", "(", "$", "datetimeToParse", ",", "&", "$", "position", ")", "{", "$", "characters", "=", "str_split", "(", "$", "datetimeToParse", ")", ";", "$", "number", "=", "''", ";", "$", "numberStarted", "=", "f...
Extracts and returns first integer number encountered in provided string. Searches for first digit and extracts all adjacent digits. Also returns position of first digit in string. @param string $datetimeToParse String to search number in @param int $position Index of first digit in string @return string Extracted number @throws Exception\InvalidParseStringException When no digit found in string
[ "Extracts", "and", "returns", "first", "integer", "number", "encountered", "in", "provided", "string", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/I18n/Parser/DatetimeParser.php#L621-L644
neos/flow-development-collection
Neos.Cache/Classes/Frontend/PhpFrontend.php
PhpFrontend.get
public function get(string $entryIdentifier) { if (!$this->isValidEntryIdentifier($entryIdentifier)) { throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233057752); } $code = $this->backend->get($entryIdentifier); if ($code === false) { return false; } preg_match('/^(?:.*\n){1}((?:.*\n)*)(?:.+\n?|\n)$/', $code, $matches); return $matches[1]; }
php
public function get(string $entryIdentifier) { if (!$this->isValidEntryIdentifier($entryIdentifier)) { throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233057752); } $code = $this->backend->get($entryIdentifier); if ($code === false) { return false; } preg_match('/^(?:.*\n){1}((?:.*\n)*)(?:.+\n?|\n)$/', $code, $matches); return $matches[1]; }
[ "public", "function", "get", "(", "string", "$", "entryIdentifier", ")", "{", "if", "(", "!", "$", "this", "->", "isValidEntryIdentifier", "(", "$", "entryIdentifier", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'\"'", ".", "$", ...
Finds and returns the original code from the cache. @param string $entryIdentifier Identifier of the cache entry to fetch @return string|bool The value @throws \InvalidArgumentException @api
[ "Finds", "and", "returns", "the", "original", "code", "from", "the", "cache", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Frontend/PhpFrontend.php#L48-L62
neos/flow-development-collection
Neos.Cache/Classes/Frontend/PhpFrontend.php
PhpFrontend.getWrapped
public function getWrapped(string $entryIdentifier): string { if (!$this->isValidEntryIdentifier($entryIdentifier)) { throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233057752); } return $this->backend->get($entryIdentifier); }
php
public function getWrapped(string $entryIdentifier): string { if (!$this->isValidEntryIdentifier($entryIdentifier)) { throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1233057752); } return $this->backend->get($entryIdentifier); }
[ "public", "function", "getWrapped", "(", "string", "$", "entryIdentifier", ")", ":", "string", "{", "if", "(", "!", "$", "this", "->", "isValidEntryIdentifier", "(", "$", "entryIdentifier", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", ...
Returns the code wrapped in php tags as written to the cache, ready to be included. @param string $entryIdentifier @return string @throws \InvalidArgumentException
[ "Returns", "the", "code", "wrapped", "in", "php", "tags", "as", "written", "to", "the", "cache", "ready", "to", "be", "included", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Frontend/PhpFrontend.php#L71-L78
neos/flow-development-collection
Neos.Cache/Classes/Frontend/PhpFrontend.php
PhpFrontend.set
public function set(string $entryIdentifier, $sourceCode, array $tags = [], int $lifetime = null) { if (!$this->isValidEntryIdentifier($entryIdentifier)) { throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1264023823); } if (!is_string($sourceCode)) { throw new InvalidDataException('The given source code is not a valid string.', 1264023824); } foreach ($tags as $tag) { if (!$this->isValidTag($tag)) { throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1264023825); } } $sourceCode = '<?php ' . $sourceCode . chr(10) . '#'; $this->backend->set($entryIdentifier, $sourceCode, $tags, $lifetime); }
php
public function set(string $entryIdentifier, $sourceCode, array $tags = [], int $lifetime = null) { if (!$this->isValidEntryIdentifier($entryIdentifier)) { throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1264023823); } if (!is_string($sourceCode)) { throw new InvalidDataException('The given source code is not a valid string.', 1264023824); } foreach ($tags as $tag) { if (!$this->isValidTag($tag)) { throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1264023825); } } $sourceCode = '<?php ' . $sourceCode . chr(10) . '#'; $this->backend->set($entryIdentifier, $sourceCode, $tags, $lifetime); }
[ "public", "function", "set", "(", "string", "$", "entryIdentifier", ",", "$", "sourceCode", ",", "array", "$", "tags", "=", "[", "]", ",", "int", "$", "lifetime", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "isValidEntryIdentifier", "(", ...
Saves the PHP source code in the cache. @param string $entryIdentifier An identifier used for this cache entry, for example the class name @param string $sourceCode PHP source code @param array $tags Tags to associate with this cache entry @param integer $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime. @return void @throws InvalidDataException @throws \InvalidArgumentException @throws \Neos\Cache\Exception @api
[ "Saves", "the", "PHP", "source", "code", "in", "the", "cache", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Frontend/PhpFrontend.php#L93-L108
neos/flow-development-collection
Neos.Flow/Classes/Validation/Validator/UniqueEntityValidator.php
UniqueEntityValidator.isValid
protected function isValid($value) { if (!is_object($value)) { throw new InvalidValidationOptionsException('The value supplied for the UniqueEntityValidator must be an object.', 1358454270); } $classSchema = $this->reflectionService->getClassSchema(TypeHandling::getTypeForValue($value)); if ($classSchema === null || $classSchema->getModelType() !== ClassSchema::MODELTYPE_ENTITY) { throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must be an entity.', 1358454284); } if ($this->options['identityProperties'] !== null) { $identityProperties = $this->options['identityProperties']; foreach ($identityProperties as $propertyName) { if ($classSchema->hasProperty($propertyName) === false) { throw new InvalidValidationOptionsException(sprintf('The custom identity property name "%s" supplied for the UniqueEntityValidator does not exists in "%s".', $propertyName, $classSchema->getClassName()), 1358960500); } } } else { $identityProperties = array_keys($classSchema->getIdentityProperties()); } if (count($identityProperties) === 0) { throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must have at least one identity property.', 1358459831); } $identifierProperties = $this->reflectionService->getPropertyNamesByAnnotation($classSchema->getClassName(), 'Doctrine\ORM\Mapping\Id'); if (count($identifierProperties) > 1) { throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must only have one identifier property @ORM\Id.', 1358501745); } $identifierPropertyName = count($identifierProperties) > 0 ? array_shift($identifierProperties) : 'Persistence_Object_Identifier'; $query = $this->persistenceManager->createQueryForType($classSchema->getClassName()); $constraints = [$query->logicalNot($query->equals($identifierPropertyName, $this->persistenceManager->getIdentifierByObject($value)))]; foreach ($identityProperties as $propertyName) { $constraints[] = $query->equals($propertyName, ObjectAccess::getProperty($value, $propertyName)); } if ($query->matching($query->logicalAnd($constraints))->count() > 0) { $this->addError('Another entity with the same unique identifiers already exists', 1355785874); } }
php
protected function isValid($value) { if (!is_object($value)) { throw new InvalidValidationOptionsException('The value supplied for the UniqueEntityValidator must be an object.', 1358454270); } $classSchema = $this->reflectionService->getClassSchema(TypeHandling::getTypeForValue($value)); if ($classSchema === null || $classSchema->getModelType() !== ClassSchema::MODELTYPE_ENTITY) { throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must be an entity.', 1358454284); } if ($this->options['identityProperties'] !== null) { $identityProperties = $this->options['identityProperties']; foreach ($identityProperties as $propertyName) { if ($classSchema->hasProperty($propertyName) === false) { throw new InvalidValidationOptionsException(sprintf('The custom identity property name "%s" supplied for the UniqueEntityValidator does not exists in "%s".', $propertyName, $classSchema->getClassName()), 1358960500); } } } else { $identityProperties = array_keys($classSchema->getIdentityProperties()); } if (count($identityProperties) === 0) { throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must have at least one identity property.', 1358459831); } $identifierProperties = $this->reflectionService->getPropertyNamesByAnnotation($classSchema->getClassName(), 'Doctrine\ORM\Mapping\Id'); if (count($identifierProperties) > 1) { throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must only have one identifier property @ORM\Id.', 1358501745); } $identifierPropertyName = count($identifierProperties) > 0 ? array_shift($identifierProperties) : 'Persistence_Object_Identifier'; $query = $this->persistenceManager->createQueryForType($classSchema->getClassName()); $constraints = [$query->logicalNot($query->equals($identifierPropertyName, $this->persistenceManager->getIdentifierByObject($value)))]; foreach ($identityProperties as $propertyName) { $constraints[] = $query->equals($propertyName, ObjectAccess::getProperty($value, $propertyName)); } if ($query->matching($query->logicalAnd($constraints))->count() > 0) { $this->addError('Another entity with the same unique identifiers already exists', 1355785874); } }
[ "protected", "function", "isValid", "(", "$", "value", ")", "{", "if", "(", "!", "is_object", "(", "$", "value", ")", ")", "{", "throw", "new", "InvalidValidationOptionsException", "(", "'The value supplied for the UniqueEntityValidator must be an object.'", ",", "135...
Checks if the given value is a unique entity depending on it's identity properties or custom configured identity properties. @param mixed $value The value that should be validated @return void @throws InvalidValidationOptionsException @api
[ "Checks", "if", "the", "given", "value", "is", "a", "unique", "entity", "depending", "on", "it", "s", "identity", "properties", "or", "custom", "configured", "identity", "properties", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Validation/Validator/UniqueEntityValidator.php#L57-L99
neos/flow-development-collection
Neos.Flow/Classes/Security/Authentication/EntryPoint/HttpBasic.php
HttpBasic.startAuthentication
public function startAuthentication(Request $request, Response $response) { $response->setStatus(401); $response->setHeader('WWW-Authenticate', 'Basic realm="' . (isset($this->options['realm']) ? $this->options['realm'] : sha1(FLOW_PATH_ROOT)) . '"'); $response->setContent('Authorization required'); }
php
public function startAuthentication(Request $request, Response $response) { $response->setStatus(401); $response->setHeader('WWW-Authenticate', 'Basic realm="' . (isset($this->options['realm']) ? $this->options['realm'] : sha1(FLOW_PATH_ROOT)) . '"'); $response->setContent('Authorization required'); }
[ "public", "function", "startAuthentication", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "response", "->", "setStatus", "(", "401", ")", ";", "$", "response", "->", "setHeader", "(", "'WWW-Authenticate'", ",", "'Basic realm...
Starts the authentication: Send HTTP header @param Request $request The current request @param Response $response The current response @return void
[ "Starts", "the", "authentication", ":", "Send", "HTTP", "header" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Security/Authentication/EntryPoint/HttpBasic.php#L29-L34
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.setLimit
public function setLimit($limit) { if ($limit < 1 || !is_int($limit)) { throw new \InvalidArgumentException('setLimit() accepts only integers greater 0.', 1263387249); } $this->limit = $limit; return $this; }
php
public function setLimit($limit) { if ($limit < 1 || !is_int($limit)) { throw new \InvalidArgumentException('setLimit() accepts only integers greater 0.', 1263387249); } $this->limit = $limit; return $this; }
[ "public", "function", "setLimit", "(", "$", "limit", ")", "{", "if", "(", "$", "limit", "<", "1", "||", "!", "is_int", "(", "$", "limit", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'setLimit() accepts only integers greater 0.'", "...
Sets the maximum size of the result set to limit. Returns $this to allow for chaining (fluid interface) @param integer $limit @return QueryInterface @throws \InvalidArgumentException @api
[ "Sets", "the", "maximum", "size", "of", "the", "result", "set", "to", "limit", ".", "Returns", "$this", "to", "allow", "for", "chaining", "(", "fluid", "interface", ")" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L192-L200
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.logicalAnd
public function logicalAnd($constraint1) { if (is_array($constraint1)) { $resultingConstraint = array_shift($constraint1); $constraints = $constraint1; } else { $constraints = func_get_args(); $resultingConstraint = array_shift($constraints); } if ($resultingConstraint === null) { throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1268056288); } foreach ($constraints as $constraint) { $resultingConstraint = $this->qomFactory->_and($resultingConstraint, $constraint); } return $resultingConstraint; }
php
public function logicalAnd($constraint1) { if (is_array($constraint1)) { $resultingConstraint = array_shift($constraint1); $constraints = $constraint1; } else { $constraints = func_get_args(); $resultingConstraint = array_shift($constraints); } if ($resultingConstraint === null) { throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1268056288); } foreach ($constraints as $constraint) { $resultingConstraint = $this->qomFactory->_and($resultingConstraint, $constraint); } return $resultingConstraint; }
[ "public", "function", "logicalAnd", "(", "$", "constraint1", ")", "{", "if", "(", "is_array", "(", "$", "constraint1", ")", ")", "{", "$", "resultingConstraint", "=", "array_shift", "(", "$", "constraint1", ")", ";", "$", "constraints", "=", "$", "constrai...
Performs a logical conjunction of the two given constraints. The method takes one or more contraints and concatenates them with a boolean AND. It also accepts a single array of constraints to be concatenated. @param mixed $constraint1 The first of multiple constraints or an array of constraints. @return Qom\LogicalAnd @throws InvalidNumberOfConstraintsException @api
[ "Performs", "a", "logical", "conjunction", "of", "the", "two", "given", "constraints", ".", "The", "method", "takes", "one", "or", "more", "contraints", "and", "concatenates", "them", "with", "a", "boolean", "AND", ".", "It", "also", "accepts", "a", "single"...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L302-L320
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.logicalOr
public function logicalOr($constraint1) { if (is_array($constraint1)) { $resultingConstraint = array_shift($constraint1); $constraints = $constraint1; } else { $constraints = func_get_args(); $resultingConstraint = array_shift($constraints); } if ($resultingConstraint === null) { throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1268056289); } foreach ($constraints as $constraint) { $resultingConstraint = $this->qomFactory->_or($resultingConstraint, $constraint); } return $resultingConstraint; }
php
public function logicalOr($constraint1) { if (is_array($constraint1)) { $resultingConstraint = array_shift($constraint1); $constraints = $constraint1; } else { $constraints = func_get_args(); $resultingConstraint = array_shift($constraints); } if ($resultingConstraint === null) { throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1268056289); } foreach ($constraints as $constraint) { $resultingConstraint = $this->qomFactory->_or($resultingConstraint, $constraint); } return $resultingConstraint; }
[ "public", "function", "logicalOr", "(", "$", "constraint1", ")", "{", "if", "(", "is_array", "(", "$", "constraint1", ")", ")", "{", "$", "resultingConstraint", "=", "array_shift", "(", "$", "constraint1", ")", ";", "$", "constraints", "=", "$", "constrain...
Performs a logical disjunction of the two given constraints. The method takes one or more constraints and concatenates them with a boolean OR. It also accepts a single array of constraints to be concatenated. @param object $constraint1 The first of multiple constraints or an array of constraints. @return Qom\LogicalOr @throws InvalidNumberOfConstraintsException @api
[ "Performs", "a", "logical", "disjunction", "of", "the", "two", "given", "constraints", ".", "The", "method", "takes", "one", "or", "more", "constraints", "and", "concatenates", "them", "with", "a", "boolean", "OR", ".", "It", "also", "accepts", "a", "single"...
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L332-L350
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.equals
public function equals($propertyName, $operand, $caseSensitive = true) { if ($operand === null) { $comparison = $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_IS_NULL ); } elseif (is_object($operand) || $caseSensitive) { $comparison = $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_EQUAL_TO, $operand ); } else { $comparison = $this->qomFactory->comparison( $this->qomFactory->lowerCase( $this->qomFactory->propertyValue($propertyName, '_entity') ), QueryInterface::OPERATOR_EQUAL_TO, strtolower($operand) ); } return $comparison; }
php
public function equals($propertyName, $operand, $caseSensitive = true) { if ($operand === null) { $comparison = $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_IS_NULL ); } elseif (is_object($operand) || $caseSensitive) { $comparison = $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_EQUAL_TO, $operand ); } else { $comparison = $this->qomFactory->comparison( $this->qomFactory->lowerCase( $this->qomFactory->propertyValue($propertyName, '_entity') ), QueryInterface::OPERATOR_EQUAL_TO, strtolower($operand) ); } return $comparison; }
[ "public", "function", "equals", "(", "$", "propertyName", ",", "$", "operand", ",", "$", "caseSensitive", "=", "true", ")", "{", "if", "(", "$", "operand", "===", "null", ")", "{", "$", "comparison", "=", "$", "this", "->", "qomFactory", "->", "compari...
Returns an equals criterion used for matching objects against a query. It matches if the $operand equals the value of the property named $propertyName. If $operand is NULL a strict check for NULL is done. For strings the comparison can be done with or without case-sensitivity. @param string $propertyName The name of the property to compare against @param mixed $operand The value to compare with @param boolean $caseSensitive Whether the equality test should be done case-sensitive for strings @return object @todo Decide what to do about equality on multi-valued properties @api
[ "Returns", "an", "equals", "criterion", "used", "for", "matching", "objects", "against", "a", "query", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L378-L402
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.like
public function like($propertyName, $operand, $caseSensitive = true) { if (!is_string($operand)) { throw new InvalidQueryException('Operand must be a string, was ' . gettype($operand), 1276781107); } if ($caseSensitive) { $comparison = $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_LIKE, $operand ); } else { $comparison = $this->qomFactory->comparison( $this->qomFactory->lowerCase( $this->qomFactory->propertyValue($propertyName, '_entity') ), QueryInterface::OPERATOR_LIKE, strtolower($operand) ); } return $comparison; }
php
public function like($propertyName, $operand, $caseSensitive = true) { if (!is_string($operand)) { throw new InvalidQueryException('Operand must be a string, was ' . gettype($operand), 1276781107); } if ($caseSensitive) { $comparison = $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_LIKE, $operand ); } else { $comparison = $this->qomFactory->comparison( $this->qomFactory->lowerCase( $this->qomFactory->propertyValue($propertyName, '_entity') ), QueryInterface::OPERATOR_LIKE, strtolower($operand) ); } return $comparison; }
[ "public", "function", "like", "(", "$", "propertyName", ",", "$", "operand", ",", "$", "caseSensitive", "=", "true", ")", "{", "if", "(", "!", "is_string", "(", "$", "operand", ")", ")", "{", "throw", "new", "InvalidQueryException", "(", "'Operand must be ...
Returns a like criterion used for matching objects against a query. Matches if the property named $propertyName is like the $operand, using standard SQL wildcards. @param string $propertyName The name of the property to compare against @param string $operand The value to compare with @param boolean $caseSensitive Whether the matching should be done case-sensitive @return object @throws InvalidQueryException if used on a non-string property @api
[ "Returns", "a", "like", "criterion", "used", "for", "matching", "objects", "against", "a", "query", ".", "Matches", "if", "the", "property", "named", "$propertyName", "is", "like", "the", "$operand", "using", "standard", "SQL", "wildcards", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L416-L438
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.contains
public function contains($propertyName, $operand) { if (!$this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must be multi-valued', 1276781026); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_CONTAINS, $operand ); }
php
public function contains($propertyName, $operand) { if (!$this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must be multi-valued', 1276781026); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_CONTAINS, $operand ); }
[ "public", "function", "contains", "(", "$", "propertyName", ",", "$", "operand", ")", "{", "if", "(", "!", "$", "this", "->", "classSchema", "->", "isMultiValuedProperty", "(", "$", "propertyName", ")", ")", "{", "throw", "new", "InvalidQueryException", "(",...
Returns a "contains" criterion used for matching objects against a query. It matches if the multivalued property contains the given operand. If NULL is given as $operand, there will never be a match! @param string $propertyName The name of the multivalued property to compare against @param mixed $operand The value to compare with @return Qom\Comparison @throws InvalidQueryException if used on a single-valued property @api
[ "Returns", "a", "contains", "criterion", "used", "for", "matching", "objects", "against", "a", "query", ".", "It", "matches", "if", "the", "multivalued", "property", "contains", "the", "given", "operand", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L452-L462
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.isEmpty
public function isEmpty($propertyName) { if (!$this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must be multi-valued', 1276853547); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_IS_EMPTY ); }
php
public function isEmpty($propertyName) { if (!$this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must be multi-valued', 1276853547); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_IS_EMPTY ); }
[ "public", "function", "isEmpty", "(", "$", "propertyName", ")", "{", "if", "(", "!", "$", "this", "->", "classSchema", "->", "isMultiValuedProperty", "(", "$", "propertyName", ")", ")", "{", "throw", "new", "InvalidQueryException", "(", "'Property \"'", ".", ...
Returns an "isEmpty" criterion used for matching objects against a query. It matches if the multivalued property contains no values or is NULL. @param string $propertyName The name of the multivalued property to check @return boolean @throws InvalidQueryException if used on a single-valued property @api
[ "Returns", "an", "isEmpty", "criterion", "used", "for", "matching", "objects", "against", "a", "query", ".", "It", "matches", "if", "the", "multivalued", "property", "contains", "no", "values", "or", "is", "NULL", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L473-L482
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.in
public function in($propertyName, $operand) { if (!is_array($operand) && (!$operand instanceof \ArrayAccess) && (!$operand instanceof \Traversable)) { throw new InvalidQueryException('The "in" constraint must be given a multi-valued operand (array, ArrayAccess, Traversable).', 1264678095); } if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued.', 1276777034); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_IN, $operand ); }
php
public function in($propertyName, $operand) { if (!is_array($operand) && (!$operand instanceof \ArrayAccess) && (!$operand instanceof \Traversable)) { throw new InvalidQueryException('The "in" constraint must be given a multi-valued operand (array, ArrayAccess, Traversable).', 1264678095); } if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued.', 1276777034); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_IN, $operand ); }
[ "public", "function", "in", "(", "$", "propertyName", ",", "$", "operand", ")", "{", "if", "(", "!", "is_array", "(", "$", "operand", ")", "&&", "(", "!", "$", "operand", "instanceof", "\\", "ArrayAccess", ")", "&&", "(", "!", "$", "operand", "instan...
Returns an "in" criterion used for matching objects against a query. It matches if the property's value is contained in the multivalued operand. @param string $propertyName The name of the property to compare against @param mixed $operand The value to compare with, multivalued @return Qom\Comparison @throws InvalidQueryException if used on a multi-valued property or with single-valued operand @api
[ "Returns", "an", "in", "criterion", "used", "for", "matching", "objects", "against", "a", "query", ".", "It", "matches", "if", "the", "property", "s", "value", "is", "contained", "in", "the", "multivalued", "operand", "." ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L494-L508
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.lessThan
public function lessThan($propertyName, $operand) { if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued', 1276784963); } if (!($operand instanceof \DateTimeInterface) && !TypeHandling::isLiteral(gettype($operand))) { throw new InvalidQueryException('Operand must be a literal or DateTime, was ' . gettype($operand), 1276784964); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_LESS_THAN, $operand ); }
php
public function lessThan($propertyName, $operand) { if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued', 1276784963); } if (!($operand instanceof \DateTimeInterface) && !TypeHandling::isLiteral(gettype($operand))) { throw new InvalidQueryException('Operand must be a literal or DateTime, was ' . gettype($operand), 1276784964); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_LESS_THAN, $operand ); }
[ "public", "function", "lessThan", "(", "$", "propertyName", ",", "$", "operand", ")", "{", "if", "(", "$", "this", "->", "classSchema", "->", "isMultiValuedProperty", "(", "$", "propertyName", ")", ")", "{", "throw", "new", "InvalidQueryException", "(", "'Pr...
Returns a less than criterion used for matching objects against a query @param string $propertyName The name of the property to compare against @param mixed $operand The value to compare with @return Qom\Comparison @throws InvalidQueryException if used on a multi-valued property or with a non-literal/non-DateTime operand @api
[ "Returns", "a", "less", "than", "criterion", "used", "for", "matching", "objects", "against", "a", "query" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L519-L533
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.lessThanOrEqual
public function lessThanOrEqual($propertyName, $operand) { if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued', 1276784943); } if (!($operand instanceof \DateTimeInterface) && !TypeHandling::isLiteral(gettype($operand))) { throw new InvalidQueryException('Operand must be a literal or DateTime, was ' . gettype($operand), 1276784944); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_LESS_THAN_OR_EQUAL_TO, $operand ); }
php
public function lessThanOrEqual($propertyName, $operand) { if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued', 1276784943); } if (!($operand instanceof \DateTimeInterface) && !TypeHandling::isLiteral(gettype($operand))) { throw new InvalidQueryException('Operand must be a literal or DateTime, was ' . gettype($operand), 1276784944); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_LESS_THAN_OR_EQUAL_TO, $operand ); }
[ "public", "function", "lessThanOrEqual", "(", "$", "propertyName", ",", "$", "operand", ")", "{", "if", "(", "$", "this", "->", "classSchema", "->", "isMultiValuedProperty", "(", "$", "propertyName", ")", ")", "{", "throw", "new", "InvalidQueryException", "(",...
Returns a less or equal than criterion used for matching objects against a query @param string $propertyName The name of the property to compare against @param mixed $operand The value to compare with @return Qom\Comparison @throws InvalidQueryException if used on a multi-valued property or with a non-literal/non-DateTime operand @api
[ "Returns", "a", "less", "or", "equal", "than", "criterion", "used", "for", "matching", "objects", "against", "a", "query" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L544-L558
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.greaterThan
public function greaterThan($propertyName, $operand) { if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued', 1276774885); } if (!($operand instanceof \DateTimeInterface) && !TypeHandling::isLiteral(gettype($operand))) { throw new InvalidQueryException('Operand must be a literal or DateTime, was ' . gettype($operand), 1276774886); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_GREATER_THAN, $operand ); }
php
public function greaterThan($propertyName, $operand) { if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued', 1276774885); } if (!($operand instanceof \DateTimeInterface) && !TypeHandling::isLiteral(gettype($operand))) { throw new InvalidQueryException('Operand must be a literal or DateTime, was ' . gettype($operand), 1276774886); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_GREATER_THAN, $operand ); }
[ "public", "function", "greaterThan", "(", "$", "propertyName", ",", "$", "operand", ")", "{", "if", "(", "$", "this", "->", "classSchema", "->", "isMultiValuedProperty", "(", "$", "propertyName", ")", ")", "{", "throw", "new", "InvalidQueryException", "(", "...
Returns a greater than criterion used for matching objects against a query @param string $propertyName The name of the property to compare against @param mixed $operand The value to compare with @return Qom\Comparison @throws InvalidQueryException if used on a multi-valued property or with a non-literal/non-DateTime operand @api
[ "Returns", "a", "greater", "than", "criterion", "used", "for", "matching", "objects", "against", "a", "query" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L569-L583
neos/flow-development-collection
Neos.Flow/Classes/Persistence/Generic/Query.php
Query.greaterThanOrEqual
public function greaterThanOrEqual($propertyName, $operand) { if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued', 1276774883); } if (!($operand instanceof \DateTimeInterface) && !TypeHandling::isLiteral(gettype($operand))) { throw new InvalidQueryException('Operand must be a literal or DateTime, was ' . gettype($operand), 1276774884); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO, $operand ); }
php
public function greaterThanOrEqual($propertyName, $operand) { if ($this->classSchema->isMultiValuedProperty($propertyName)) { throw new InvalidQueryException('Property "' . $propertyName . '" must not be multi-valued', 1276774883); } if (!($operand instanceof \DateTimeInterface) && !TypeHandling::isLiteral(gettype($operand))) { throw new InvalidQueryException('Operand must be a literal or DateTime, was ' . gettype($operand), 1276774884); } return $this->qomFactory->comparison( $this->qomFactory->propertyValue($propertyName, '_entity'), QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO, $operand ); }
[ "public", "function", "greaterThanOrEqual", "(", "$", "propertyName", ",", "$", "operand", ")", "{", "if", "(", "$", "this", "->", "classSchema", "->", "isMultiValuedProperty", "(", "$", "propertyName", ")", ")", "{", "throw", "new", "InvalidQueryException", "...
Returns a greater than or equal criterion used for matching objects against a query @param string $propertyName The name of the property to compare against @param mixed $operand The value to compare with @return Qom\Comparison @throws InvalidQueryException if used on a multi-valued property or with a non-literal/non-DateTime operand @api
[ "Returns", "a", "greater", "than", "or", "equal", "criterion", "used", "for", "matching", "objects", "against", "a", "query" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Generic/Query.php#L594-L608
neos/flow-development-collection
Neos.Flow/Classes/Mvc/RequestMatcher.php
RequestMatcher.matchRequestProperty
protected function matchRequestProperty($propertyName, $expectedValue, $weight) { if ($this->request === null) { return false; } $value = ObjectAccess::getProperty($this->request, $propertyName); if ($value === $expectedValue) { $this->addWeight($weight); return true; } return false; }
php
protected function matchRequestProperty($propertyName, $expectedValue, $weight) { if ($this->request === null) { return false; } $value = ObjectAccess::getProperty($this->request, $propertyName); if ($value === $expectedValue) { $this->addWeight($weight); return true; } return false; }
[ "protected", "function", "matchRequestProperty", "(", "$", "propertyName", ",", "$", "expectedValue", ",", "$", "weight", ")", "{", "if", "(", "$", "this", "->", "request", "===", "null", ")", "{", "return", "false", ";", "}", "$", "value", "=", "ObjectA...
Compare a request propertyValue against an expected value and add the weight if it's true @param string $propertyName @param string $expectedValue @param integer $weight @return boolean
[ "Compare", "a", "request", "propertyValue", "against", "an", "expected", "value", "and", "add", "the", "weight", "if", "it", "s", "true" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/RequestMatcher.php#L139-L152
neos/flow-development-collection
Neos.Flow/Classes/Mvc/RequestMatcher.php
RequestMatcher.getParentRequest
public function getParentRequest() { if ($this->request === null || $this->request->isMainRequest()) { return new RequestMatcher(); } $this->addWeight(1000000); return new RequestMatcher($this->request->getParentRequest(), $this); }
php
public function getParentRequest() { if ($this->request === null || $this->request->isMainRequest()) { return new RequestMatcher(); } $this->addWeight(1000000); return new RequestMatcher($this->request->getParentRequest(), $this); }
[ "public", "function", "getParentRequest", "(", ")", "{", "if", "(", "$", "this", "->", "request", "===", "null", "||", "$", "this", "->", "request", "->", "isMainRequest", "(", ")", ")", "{", "return", "new", "RequestMatcher", "(", ")", ";", "}", "$", ...
Get a new RequestMatcher for the Request's ParentRequest @return RequestMatcher @api
[ "Get", "a", "new", "RequestMatcher", "for", "the", "Request", "s", "ParentRequest" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/RequestMatcher.php#L160-L167
neos/flow-development-collection
Neos.Flow/Classes/Mvc/RequestMatcher.php
RequestMatcher.addWeight
public function addWeight($weight) { $this->weight += $weight; if ($this->parentMatcher !== null) { $this->parentMatcher->addWeight($weight); } }
php
public function addWeight($weight) { $this->weight += $weight; if ($this->parentMatcher !== null) { $this->parentMatcher->addWeight($weight); } }
[ "public", "function", "addWeight", "(", "$", "weight", ")", "{", "$", "this", "->", "weight", "+=", "$", "weight", ";", "if", "(", "$", "this", "->", "parentMatcher", "!==", "null", ")", "{", "$", "this", "->", "parentMatcher", "->", "addWeight", "(", ...
Add a weight to the total @param integer $weight @return void
[ "Add", "a", "weight", "to", "the", "total" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/RequestMatcher.php#L197-L203
neos/flow-development-collection
Neos.Eel/Classes/Helper/ArrayHelper.php
ArrayHelper.concat
public function concat($array1, $array2, $array_ = null): array { $arguments = func_get_args(); foreach ($arguments as &$argument) { if (!is_array($argument)) { $argument = [$argument]; } } return call_user_func_array('array_merge', $arguments); }
php
public function concat($array1, $array2, $array_ = null): array { $arguments = func_get_args(); foreach ($arguments as &$argument) { if (!is_array($argument)) { $argument = [$argument]; } } return call_user_func_array('array_merge', $arguments); }
[ "public", "function", "concat", "(", "$", "array1", ",", "$", "array2", ",", "$", "array_", "=", "null", ")", ":", "array", "{", "$", "arguments", "=", "func_get_args", "(", ")", ";", "foreach", "(", "$", "arguments", "as", "&", "$", "argument", ")",...
Concatenate arrays or values to a new array @param array|mixed $array1 First array or value @param array|mixed $array2 Second array or value @param array|mixed $array_ Optional variable list of additional arrays / values @return array The array with concatenated arrays or values
[ "Concatenate", "arrays", "or", "values", "to", "a", "new", "array" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/Helper/ArrayHelper.php#L38-L47
neos/flow-development-collection
Neos.Eel/Classes/Helper/ArrayHelper.php
ArrayHelper.slice
public function slice(array $array, $begin, $end = null): array { if ($end === null) { $end = count($array); } elseif ($end < 0) { $end = count($array) + $end; } $length = $end - $begin; return array_slice($array, $begin, $length); }
php
public function slice(array $array, $begin, $end = null): array { if ($end === null) { $end = count($array); } elseif ($end < 0) { $end = count($array) + $end; } $length = $end - $begin; return array_slice($array, $begin, $length); }
[ "public", "function", "slice", "(", "array", "$", "array", ",", "$", "begin", ",", "$", "end", "=", "null", ")", ":", "array", "{", "if", "(", "$", "end", "===", "null", ")", "{", "$", "end", "=", "count", "(", "$", "array", ")", ";", "}", "e...
Extract a portion of an indexed array @param array $array The array (with numeric indices) @param int $begin @param int $end @return array
[ "Extract", "a", "portion", "of", "an", "indexed", "array" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/Helper/ArrayHelper.php#L69-L78
neos/flow-development-collection
Neos.Eel/Classes/Helper/ArrayHelper.php
ArrayHelper.indexOf
public function indexOf(array $array, $searchElement, $fromIndex = null): int { if ($fromIndex !== null) { $array = array_slice($array, $fromIndex, null, true); } $result = array_search($searchElement, $array, true); if ($result === false) { return -1; } return $result; }
php
public function indexOf(array $array, $searchElement, $fromIndex = null): int { if ($fromIndex !== null) { $array = array_slice($array, $fromIndex, null, true); } $result = array_search($searchElement, $array, true); if ($result === false) { return -1; } return $result; }
[ "public", "function", "indexOf", "(", "array", "$", "array", ",", "$", "searchElement", ",", "$", "fromIndex", "=", "null", ")", ":", "int", "{", "if", "(", "$", "fromIndex", "!==", "null", ")", "{", "$", "array", "=", "array_slice", "(", "$", "array...
Returns the first index at which a given element can be found in the array, or -1 if it is not present @param array $array The array @param mixed $searchElement The element value to find @param int $fromIndex Position in the array to start the search. @return int
[ "Returns", "the", "first", "index", "at", "which", "a", "given", "element", "can", "be", "found", "in", "the", "array", "or", "-", "1", "if", "it", "is", "not", "present" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/Helper/ArrayHelper.php#L155-L165
neos/flow-development-collection
Neos.Eel/Classes/Helper/ArrayHelper.php
ArrayHelper.sort
public function sort(array $array): array { if ($array === []) { return $array; } natsort($array); $i = 0; $newArray = []; foreach ($array as $key => $value) { if (is_string($key)) { $newArray[$key] = $value; } else { $newArray[$i] = $value; $i++; } } return $newArray; }
php
public function sort(array $array): array { if ($array === []) { return $array; } natsort($array); $i = 0; $newArray = []; foreach ($array as $key => $value) { if (is_string($key)) { $newArray[$key] = $value; } else { $newArray[$i] = $value; $i++; } } return $newArray; }
[ "public", "function", "sort", "(", "array", "$", "array", ")", ":", "array", "{", "if", "(", "$", "array", "===", "[", "]", ")", "{", "return", "$", "array", ";", "}", "natsort", "(", "$", "array", ")", ";", "$", "i", "=", "0", ";", "$", "new...
Sorts an array The sorting is done first by numbers, then by characters. Internally natsort() is used as it most closely resembles javascript's sort(). Because there are no real associative arrays in Javascript, keys of the array will be preserved. @param array $array @return array The sorted array
[ "Sorts", "an", "array" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/Helper/ArrayHelper.php#L193-L210
neos/flow-development-collection
Neos.Eel/Classes/Helper/ArrayHelper.php
ArrayHelper.shuffle
public function shuffle(array $array, $preserveKeys = true): array { if ($array === []) { return $array; } if ($preserveKeys) { $keys = array_keys($array); shuffle($keys); $shuffledArray = []; foreach ($keys as $key) { $shuffledArray[$key] = $array[$key]; } $array = $shuffledArray; } else { shuffle($array); } return $array; }
php
public function shuffle(array $array, $preserveKeys = true): array { if ($array === []) { return $array; } if ($preserveKeys) { $keys = array_keys($array); shuffle($keys); $shuffledArray = []; foreach ($keys as $key) { $shuffledArray[$key] = $array[$key]; } $array = $shuffledArray; } else { shuffle($array); } return $array; }
[ "public", "function", "shuffle", "(", "array", "$", "array", ",", "$", "preserveKeys", "=", "true", ")", ":", "array", "{", "if", "(", "$", "array", "===", "[", "]", ")", "{", "return", "$", "array", ";", "}", "if", "(", "$", "preserveKeys", ")", ...
Shuffle an array Randomizes entries an array with the option to preserve the existing keys. When this option is set to false, all keys will be replaced @param array $array @param bool $preserveKeys Wether to preserve the keys when shuffling the array @return array The shuffled array
[ "Shuffle", "an", "array" ]
train
https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/Helper/ArrayHelper.php#L222-L239