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.Eel/Classes/FlowQuery/Operations/FirstOperation.php | FirstOperation.evaluate | public function evaluate(FlowQuery $flowQuery, array $arguments)
{
$context = $flowQuery->getContext();
if (isset($context[0])) {
$flowQuery->setContext([$context[0]]);
} else {
$flowQuery->setContext([]);
}
} | php | public function evaluate(FlowQuery $flowQuery, array $arguments)
{
$context = $flowQuery->getContext();
if (isset($context[0])) {
$flowQuery->setContext([$context[0]]);
} else {
$flowQuery->setContext([]);
}
} | [
"public",
"function",
"evaluate",
"(",
"FlowQuery",
"$",
"flowQuery",
",",
"array",
"$",
"arguments",
")",
"{",
"$",
"context",
"=",
"$",
"flowQuery",
"->",
"getContext",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"context",
"[",
"0",
"]",
")",
")"... | {@inheritdoc}
@param FlowQuery $flowQuery the FlowQuery object
@param array $arguments Ignored for this operation
@return void | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/FlowQuery/Operations/FirstOperation.php#L35-L43 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/Argument.php | Argument.setValue | public function setValue($rawValue)
{
if ($rawValue === null) {
$this->value = null;
return $this;
}
if (is_object($rawValue) && $rawValue instanceof $this->dataType) {
$this->value = $rawValue;
return $this;
}
$this->value = $this->propertyMapper->convert($rawValue, $this->dataType, $this->getPropertyMappingConfiguration());
$this->validationResults = $this->propertyMapper->getMessages();
if ($this->validator !== null) {
$validationMessages = $this->validator->validate($this->value);
$this->validationResults->merge($validationMessages);
}
return $this;
} | php | public function setValue($rawValue)
{
if ($rawValue === null) {
$this->value = null;
return $this;
}
if (is_object($rawValue) && $rawValue instanceof $this->dataType) {
$this->value = $rawValue;
return $this;
}
$this->value = $this->propertyMapper->convert($rawValue, $this->dataType, $this->getPropertyMappingConfiguration());
$this->validationResults = $this->propertyMapper->getMessages();
if ($this->validator !== null) {
$validationMessages = $this->validator->validate($this->value);
$this->validationResults->merge($validationMessages);
}
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"rawValue",
")",
"{",
"if",
"(",
"$",
"rawValue",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"is_object",
"(",
"$",
"rawValue",
")",... | Sets the value of this argument.
@param mixed $rawValue The value of this argument
@return Argument $this | [
"Sets",
"the",
"value",
"of",
"this",
"argument",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/Argument.php#L200-L218 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Repository.php | Repository.add | public function add($object)
{
if (!is_object($object) || !($object instanceof $this->entityClassName)) {
$type = (is_object($object) ? get_class($object) : gettype($object));
throw new IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->entityClassName . ' instances.', 1298403438);
}
$this->persistenceManager->add($object);
} | php | public function add($object)
{
if (!is_object($object) || !($object instanceof $this->entityClassName)) {
$type = (is_object($object) ? get_class($object) : gettype($object));
throw new IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->entityClassName . ' instances.', 1298403438);
}
$this->persistenceManager->add($object);
} | [
"public",
"function",
"add",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
"||",
"!",
"(",
"$",
"object",
"instanceof",
"$",
"this",
"->",
"entityClassName",
")",
")",
"{",
"$",
"type",
"=",
"(",
"is_object",
"... | Adds an object to this repository.
@param object $object The object to add
@return void
@throws IllegalObjectTypeException
@api | [
"Adds",
"an",
"object",
"to",
"this",
"repository",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Repository.php#L77-L84 |
neos/flow-development-collection | Neos.Flow/Classes/Persistence/Repository.php | Repository.createQuery | public function createQuery()
{
$query = $this->persistenceManager->createQueryForType($this->entityClassName);
if ($this->defaultOrderings !== []) {
$query->setOrderings($this->defaultOrderings);
}
return $query;
} | php | public function createQuery()
{
$query = $this->persistenceManager->createQueryForType($this->entityClassName);
if ($this->defaultOrderings !== []) {
$query->setOrderings($this->defaultOrderings);
}
return $query;
} | [
"public",
"function",
"createQuery",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"persistenceManager",
"->",
"createQueryForType",
"(",
"$",
"this",
"->",
"entityClassName",
")",
";",
"if",
"(",
"$",
"this",
"->",
"defaultOrderings",
"!==",
"[",
"... | Returns a query for objects of this repository
@return QueryInterface
@api | [
"Returns",
"a",
"query",
"for",
"objects",
"of",
"this",
"repository"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Persistence/Repository.php#L133-L140 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.buildObjectConfigurations | public function buildObjectConfigurations(array $availableClassAndInterfaceNamesByPackage, array $rawObjectConfigurationsByPackages)
{
$objectConfigurations = [];
$interfaceNames = [];
foreach ($availableClassAndInterfaceNamesByPackage as $packageKey => $classAndInterfaceNames) {
foreach ($classAndInterfaceNames as $classOrInterfaceName) {
$objectName = $classOrInterfaceName;
if ($this->reflectionService->isClassUnconfigurable($classOrInterfaceName)) {
continue;
}
if (interface_exists($classOrInterfaceName)) {
$interfaceName = $classOrInterfaceName;
$implementationClassName = $this->reflectionService->getDefaultImplementationClassNameForInterface($interfaceName);
if (!isset($rawObjectConfigurationsByPackages[$packageKey][$interfaceName]) && $implementationClassName === false) {
continue;
}
if ($this->reflectionService->isClassAnnotatedWith($interfaceName, Flow\Scope::class)) {
throw new InvalidObjectConfigurationException(sprintf('Scope annotations in interfaces don\'t have any effect, therefore you better remove it from %s in order to avoid confusion.', $interfaceName), 1299095595);
}
$interfaceNames[$interfaceName] = true;
} else {
$implementationClassName = $classOrInterfaceName;
}
$rawObjectConfiguration = ['className' => $implementationClassName];
$rawObjectConfiguration = $this->enhanceRawConfigurationWithAnnotationOptions($classOrInterfaceName, $rawObjectConfiguration);
$objectConfigurations[$objectName] = $this->parseConfigurationArray($objectName, $rawObjectConfiguration, 'automatically registered class');
$objectConfigurations[$objectName]->setPackageKey($packageKey);
}
}
foreach ($rawObjectConfigurationsByPackages as $packageKey => $rawObjectConfigurations) {
foreach ($rawObjectConfigurations as $objectName => $rawObjectConfiguration) {
$objectName = str_replace('_', '\\', $objectName);
if (!is_array($rawObjectConfiguration)) {
throw new InvalidObjectConfigurationException('Configuration of object "' . $objectName . '" in package "' . $packageKey . '" is not an array, please check your Objects.yaml for syntax errors.', 1295954338);
}
$existingObjectConfiguration = (isset($objectConfigurations[$objectName])) ? $objectConfigurations[$objectName] : null;
if (isset($rawObjectConfiguration['className'])) {
$rawObjectConfiguration = $this->enhanceRawConfigurationWithAnnotationOptions($rawObjectConfiguration['className'], $rawObjectConfiguration);
}
$newObjectConfiguration = $this->parseConfigurationArray($objectName, $rawObjectConfiguration, 'configuration of package ' . $packageKey . ', definition for object "' . $objectName . '"', $existingObjectConfiguration);
if (!isset($objectConfigurations[$objectName]) && !interface_exists($objectName, true) && !class_exists($objectName, false)) {
throw new InvalidObjectConfigurationException('Tried to configure unknown object "' . $objectName . '" in package "' . $packageKey . '". Please check your Objects.yaml.', 1184926175);
}
if ($objectName !== $newObjectConfiguration->getClassName() && !interface_exists($objectName, true)) {
throw new InvalidObjectConfigurationException('Tried to set a differing class name for class "' . $objectName . '" in the object configuration of package "' . $packageKey . '". Setting "className" is only allowed for interfaces, please check your Objects.yaml."', 1295954589);
}
if (empty($newObjectConfiguration->getClassName()) && empty($newObjectConfiguration->getFactoryObjectName())) {
$count = count($this->reflectionService->getAllImplementationClassNamesForInterface($objectName));
$hint = ($count ? 'It seems like there is no class which implements that interface, maybe the object configuration is obsolete?' : sprintf('There are %s classes implementing that interface, therefore you must specify a specific class in your object configuration.', $count));
throw new InvalidObjectConfigurationException('The object configuration for "' . $objectName . '" in the object configuration of package "' . $packageKey . '" lacks a "className" entry. ' . $hint, 1422566751);
}
$objectConfigurations[$objectName] = $newObjectConfiguration;
if ($objectConfigurations[$objectName]->getPackageKey() === null) {
$objectConfigurations[$objectName]->setPackageKey($packageKey);
}
}
}
// If an implementation class could be determined for an interface object configuration, set the scope for the
// interface object configuration to the scope found in the implementation class configuration, but
// only if the interface doesn't have a specifically configured scope (i.e. is prototype so far)
foreach (array_keys($interfaceNames) as $interfaceName) {
$implementationClassName = $objectConfigurations[$interfaceName]->getClassName();
if ($implementationClassName !== '' && isset($objectConfigurations[$implementationClassName]) && $objectConfigurations[$interfaceName]->getScope() === Configuration::SCOPE_PROTOTYPE) {
$objectConfigurations[$interfaceName]->setScope($objectConfigurations[$implementationClassName]->getScope());
}
}
$this->autowireArguments($objectConfigurations);
$this->autowireProperties($objectConfigurations);
return $objectConfigurations;
} | php | public function buildObjectConfigurations(array $availableClassAndInterfaceNamesByPackage, array $rawObjectConfigurationsByPackages)
{
$objectConfigurations = [];
$interfaceNames = [];
foreach ($availableClassAndInterfaceNamesByPackage as $packageKey => $classAndInterfaceNames) {
foreach ($classAndInterfaceNames as $classOrInterfaceName) {
$objectName = $classOrInterfaceName;
if ($this->reflectionService->isClassUnconfigurable($classOrInterfaceName)) {
continue;
}
if (interface_exists($classOrInterfaceName)) {
$interfaceName = $classOrInterfaceName;
$implementationClassName = $this->reflectionService->getDefaultImplementationClassNameForInterface($interfaceName);
if (!isset($rawObjectConfigurationsByPackages[$packageKey][$interfaceName]) && $implementationClassName === false) {
continue;
}
if ($this->reflectionService->isClassAnnotatedWith($interfaceName, Flow\Scope::class)) {
throw new InvalidObjectConfigurationException(sprintf('Scope annotations in interfaces don\'t have any effect, therefore you better remove it from %s in order to avoid confusion.', $interfaceName), 1299095595);
}
$interfaceNames[$interfaceName] = true;
} else {
$implementationClassName = $classOrInterfaceName;
}
$rawObjectConfiguration = ['className' => $implementationClassName];
$rawObjectConfiguration = $this->enhanceRawConfigurationWithAnnotationOptions($classOrInterfaceName, $rawObjectConfiguration);
$objectConfigurations[$objectName] = $this->parseConfigurationArray($objectName, $rawObjectConfiguration, 'automatically registered class');
$objectConfigurations[$objectName]->setPackageKey($packageKey);
}
}
foreach ($rawObjectConfigurationsByPackages as $packageKey => $rawObjectConfigurations) {
foreach ($rawObjectConfigurations as $objectName => $rawObjectConfiguration) {
$objectName = str_replace('_', '\\', $objectName);
if (!is_array($rawObjectConfiguration)) {
throw new InvalidObjectConfigurationException('Configuration of object "' . $objectName . '" in package "' . $packageKey . '" is not an array, please check your Objects.yaml for syntax errors.', 1295954338);
}
$existingObjectConfiguration = (isset($objectConfigurations[$objectName])) ? $objectConfigurations[$objectName] : null;
if (isset($rawObjectConfiguration['className'])) {
$rawObjectConfiguration = $this->enhanceRawConfigurationWithAnnotationOptions($rawObjectConfiguration['className'], $rawObjectConfiguration);
}
$newObjectConfiguration = $this->parseConfigurationArray($objectName, $rawObjectConfiguration, 'configuration of package ' . $packageKey . ', definition for object "' . $objectName . '"', $existingObjectConfiguration);
if (!isset($objectConfigurations[$objectName]) && !interface_exists($objectName, true) && !class_exists($objectName, false)) {
throw new InvalidObjectConfigurationException('Tried to configure unknown object "' . $objectName . '" in package "' . $packageKey . '". Please check your Objects.yaml.', 1184926175);
}
if ($objectName !== $newObjectConfiguration->getClassName() && !interface_exists($objectName, true)) {
throw new InvalidObjectConfigurationException('Tried to set a differing class name for class "' . $objectName . '" in the object configuration of package "' . $packageKey . '". Setting "className" is only allowed for interfaces, please check your Objects.yaml."', 1295954589);
}
if (empty($newObjectConfiguration->getClassName()) && empty($newObjectConfiguration->getFactoryObjectName())) {
$count = count($this->reflectionService->getAllImplementationClassNamesForInterface($objectName));
$hint = ($count ? 'It seems like there is no class which implements that interface, maybe the object configuration is obsolete?' : sprintf('There are %s classes implementing that interface, therefore you must specify a specific class in your object configuration.', $count));
throw new InvalidObjectConfigurationException('The object configuration for "' . $objectName . '" in the object configuration of package "' . $packageKey . '" lacks a "className" entry. ' . $hint, 1422566751);
}
$objectConfigurations[$objectName] = $newObjectConfiguration;
if ($objectConfigurations[$objectName]->getPackageKey() === null) {
$objectConfigurations[$objectName]->setPackageKey($packageKey);
}
}
}
// If an implementation class could be determined for an interface object configuration, set the scope for the
// interface object configuration to the scope found in the implementation class configuration, but
// only if the interface doesn't have a specifically configured scope (i.e. is prototype so far)
foreach (array_keys($interfaceNames) as $interfaceName) {
$implementationClassName = $objectConfigurations[$interfaceName]->getClassName();
if ($implementationClassName !== '' && isset($objectConfigurations[$implementationClassName]) && $objectConfigurations[$interfaceName]->getScope() === Configuration::SCOPE_PROTOTYPE) {
$objectConfigurations[$interfaceName]->setScope($objectConfigurations[$implementationClassName]->getScope());
}
}
$this->autowireArguments($objectConfigurations);
$this->autowireProperties($objectConfigurations);
return $objectConfigurations;
} | [
"public",
"function",
"buildObjectConfigurations",
"(",
"array",
"$",
"availableClassAndInterfaceNamesByPackage",
",",
"array",
"$",
"rawObjectConfigurationsByPackages",
")",
"{",
"$",
"objectConfigurations",
"=",
"[",
"]",
";",
"$",
"interfaceNames",
"=",
"[",
"]",
"... | Traverses through the given class and interface names and builds a base object configuration
for all of them. Then parses the provided extra configuration and merges the result
into the overall configuration. Finally autowires dependencies of arguments and properties
which can be resolved automatically.
@param array $availableClassAndInterfaceNamesByPackage An array of available class names, grouped by package key
@param array $rawObjectConfigurationsByPackages An array of package keys and their raw (ie. unparsed) object configurations
@return array<Configuration> Object configurations
@throws InvalidObjectConfigurationException | [
"Traverses",
"through",
"the",
"given",
"class",
"and",
"interface",
"names",
"and",
"builds",
"a",
"base",
"object",
"configuration",
"for",
"all",
"of",
"them",
".",
"Then",
"parses",
"the",
"provided",
"extra",
"configuration",
"and",
"merges",
"the",
"resu... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L76-L158 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.enhanceRawConfigurationWithAnnotationOptions | protected function enhanceRawConfigurationWithAnnotationOptions($className, array $rawObjectConfiguration)
{
if ($this->reflectionService->isClassAnnotatedWith($className, Flow\Scope::class)) {
$rawObjectConfiguration['scope'] = $this->reflectionService->getClassAnnotation($className, Flow\Scope::class)->value;
}
if ($this->reflectionService->isClassAnnotatedWith($className, Flow\Autowiring::class)) {
$rawObjectConfiguration['autowiring'] = $this->reflectionService->getClassAnnotation($className, Flow\Autowiring::class)->enabled;
}
return $rawObjectConfiguration;
} | php | protected function enhanceRawConfigurationWithAnnotationOptions($className, array $rawObjectConfiguration)
{
if ($this->reflectionService->isClassAnnotatedWith($className, Flow\Scope::class)) {
$rawObjectConfiguration['scope'] = $this->reflectionService->getClassAnnotation($className, Flow\Scope::class)->value;
}
if ($this->reflectionService->isClassAnnotatedWith($className, Flow\Autowiring::class)) {
$rawObjectConfiguration['autowiring'] = $this->reflectionService->getClassAnnotation($className, Flow\Autowiring::class)->enabled;
}
return $rawObjectConfiguration;
} | [
"protected",
"function",
"enhanceRawConfigurationWithAnnotationOptions",
"(",
"$",
"className",
",",
"array",
"$",
"rawObjectConfiguration",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"reflectionService",
"->",
"isClassAnnotatedWith",
"(",
"$",
"className",
",",
"Flow",
... | Builds a raw configuration array by parsing possible scope and autowiring
annotations from the given class or interface.
@param string $className
@param array $rawObjectConfiguration
@return array | [
"Builds",
"a",
"raw",
"configuration",
"array",
"by",
"parsing",
"possible",
"scope",
"and",
"autowiring",
"annotations",
"from",
"the",
"given",
"class",
"or",
"interface",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L168-L177 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.parseConfigurationArray | protected function parseConfigurationArray($objectName, array $rawConfigurationOptions, $configurationSourceHint = '', $existingObjectConfiguration = null)
{
$className = (isset($rawConfigurationOptions['className']) ? $rawConfigurationOptions['className'] : $objectName);
$objectConfiguration = ($existingObjectConfiguration instanceof Configuration) ? $existingObjectConfiguration : new Configuration($objectName, $className);
$objectConfiguration->setConfigurationSourceHint($configurationSourceHint);
foreach ($rawConfigurationOptions as $optionName => $optionValue) {
switch ($optionName) {
case 'scope':
$objectConfiguration->setScope($this->parseScope($optionValue));
break;
case 'properties':
if (is_array($optionValue)) {
foreach ($optionValue as $propertyName => $propertyValue) {
if (array_key_exists('value', $propertyValue)) {
$property = new ConfigurationProperty($propertyName, $propertyValue['value'], ConfigurationProperty::PROPERTY_TYPES_STRAIGHTVALUE);
} elseif (array_key_exists('object', $propertyValue)) {
$property = $this->parsePropertyOfTypeObject($propertyName, $propertyValue['object'], $objectConfiguration);
} elseif (array_key_exists('setting', $propertyValue)) {
$property = new ConfigurationProperty($propertyName, ['type' => ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'path' => $propertyValue['setting']], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
} else {
throw new InvalidObjectConfigurationException('Invalid configuration syntax. Expecting "value", "object" or "setting" as value for property "' . $propertyName . '", instead found "' . (is_array($propertyValue) ? implode(', ', array_keys($propertyValue)) : $propertyValue) . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1230563249);
}
$objectConfiguration->setProperty($property);
}
}
break;
case 'arguments':
if (is_array($optionValue)) {
foreach ($optionValue as $argumentName => $argumentValue) {
if (array_key_exists('value', $argumentValue)) {
$argument = new ConfigurationArgument($argumentName, $argumentValue['value'], ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
} elseif (array_key_exists('object', $argumentValue)) {
$argument = $this->parseArgumentOfTypeObject($argumentName, $argumentValue['object'], $configurationSourceHint);
} elseif (array_key_exists('setting', $argumentValue)) {
$argument = new ConfigurationArgument($argumentName, $argumentValue['setting'], ConfigurationArgument::ARGUMENT_TYPES_SETTING);
} else {
throw new InvalidObjectConfigurationException('Invalid configuration syntax. Expecting "value", "object" or "setting" as value for argument "' . $argumentName . '", instead found "' . (is_array($argumentValue) ? implode(', ', array_keys($argumentValue)) : $argumentValue) . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1230563250);
}
$objectConfiguration->setArgument($argument);
}
}
break;
case 'className':
case 'factoryObjectName':
case 'factoryMethodName':
case 'lifecycleInitializationMethodName':
case 'lifecycleShutdownMethodName':
$methodName = 'set' . ucfirst($optionName);
$objectConfiguration->$methodName(trim($optionValue));
break;
case 'autowiring':
$objectConfiguration->setAutowiring($this->parseAutowiring($optionValue));
break;
default:
throw new InvalidObjectConfigurationException('Invalid configuration option "' . $optionName . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1167574981);
}
}
return $objectConfiguration;
} | php | protected function parseConfigurationArray($objectName, array $rawConfigurationOptions, $configurationSourceHint = '', $existingObjectConfiguration = null)
{
$className = (isset($rawConfigurationOptions['className']) ? $rawConfigurationOptions['className'] : $objectName);
$objectConfiguration = ($existingObjectConfiguration instanceof Configuration) ? $existingObjectConfiguration : new Configuration($objectName, $className);
$objectConfiguration->setConfigurationSourceHint($configurationSourceHint);
foreach ($rawConfigurationOptions as $optionName => $optionValue) {
switch ($optionName) {
case 'scope':
$objectConfiguration->setScope($this->parseScope($optionValue));
break;
case 'properties':
if (is_array($optionValue)) {
foreach ($optionValue as $propertyName => $propertyValue) {
if (array_key_exists('value', $propertyValue)) {
$property = new ConfigurationProperty($propertyName, $propertyValue['value'], ConfigurationProperty::PROPERTY_TYPES_STRAIGHTVALUE);
} elseif (array_key_exists('object', $propertyValue)) {
$property = $this->parsePropertyOfTypeObject($propertyName, $propertyValue['object'], $objectConfiguration);
} elseif (array_key_exists('setting', $propertyValue)) {
$property = new ConfigurationProperty($propertyName, ['type' => ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'path' => $propertyValue['setting']], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
} else {
throw new InvalidObjectConfigurationException('Invalid configuration syntax. Expecting "value", "object" or "setting" as value for property "' . $propertyName . '", instead found "' . (is_array($propertyValue) ? implode(', ', array_keys($propertyValue)) : $propertyValue) . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1230563249);
}
$objectConfiguration->setProperty($property);
}
}
break;
case 'arguments':
if (is_array($optionValue)) {
foreach ($optionValue as $argumentName => $argumentValue) {
if (array_key_exists('value', $argumentValue)) {
$argument = new ConfigurationArgument($argumentName, $argumentValue['value'], ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
} elseif (array_key_exists('object', $argumentValue)) {
$argument = $this->parseArgumentOfTypeObject($argumentName, $argumentValue['object'], $configurationSourceHint);
} elseif (array_key_exists('setting', $argumentValue)) {
$argument = new ConfigurationArgument($argumentName, $argumentValue['setting'], ConfigurationArgument::ARGUMENT_TYPES_SETTING);
} else {
throw new InvalidObjectConfigurationException('Invalid configuration syntax. Expecting "value", "object" or "setting" as value for argument "' . $argumentName . '", instead found "' . (is_array($argumentValue) ? implode(', ', array_keys($argumentValue)) : $argumentValue) . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1230563250);
}
$objectConfiguration->setArgument($argument);
}
}
break;
case 'className':
case 'factoryObjectName':
case 'factoryMethodName':
case 'lifecycleInitializationMethodName':
case 'lifecycleShutdownMethodName':
$methodName = 'set' . ucfirst($optionName);
$objectConfiguration->$methodName(trim($optionValue));
break;
case 'autowiring':
$objectConfiguration->setAutowiring($this->parseAutowiring($optionValue));
break;
default:
throw new InvalidObjectConfigurationException('Invalid configuration option "' . $optionName . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1167574981);
}
}
return $objectConfiguration;
} | [
"protected",
"function",
"parseConfigurationArray",
"(",
"$",
"objectName",
",",
"array",
"$",
"rawConfigurationOptions",
",",
"$",
"configurationSourceHint",
"=",
"''",
",",
"$",
"existingObjectConfiguration",
"=",
"null",
")",
"{",
"$",
"className",
"=",
"(",
"i... | Builds an object configuration object from a generic configuration container.
@param string $objectName Name of the object
@param array $rawConfigurationOptions The configuration array with options for the object configuration
@param string $configurationSourceHint A human readable hint on the original source of the configuration (for troubleshooting)
@param Configuration $existingObjectConfiguration If set, this object configuration object will be used instead of creating a fresh one
@return Configuration The object configuration object
@throws InvalidObjectConfigurationException if errors occurred during parsing | [
"Builds",
"an",
"object",
"configuration",
"object",
"from",
"a",
"generic",
"configuration",
"container",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L189-L248 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.parseScope | protected function parseScope($value)
{
switch ($value) {
case 'singleton':
return Configuration::SCOPE_SINGLETON;
case 'prototype':
return Configuration::SCOPE_PROTOTYPE;
case 'session':
return Configuration::SCOPE_SESSION;
default:
throw new InvalidObjectConfigurationException('Invalid scope "' . $value . '"', 1167574991);
}
} | php | protected function parseScope($value)
{
switch ($value) {
case 'singleton':
return Configuration::SCOPE_SINGLETON;
case 'prototype':
return Configuration::SCOPE_PROTOTYPE;
case 'session':
return Configuration::SCOPE_SESSION;
default:
throw new InvalidObjectConfigurationException('Invalid scope "' . $value . '"', 1167574991);
}
} | [
"protected",
"function",
"parseScope",
"(",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"value",
")",
"{",
"case",
"'singleton'",
":",
"return",
"Configuration",
"::",
"SCOPE_SINGLETON",
";",
"case",
"'prototype'",
":",
"return",
"Configuration",
"::",
"SCOPE_... | Parses the value of the option "scope"
@param string $value Value of the option
@return integer The scope translated into a Configuration::SCOPE_* constant
@throws InvalidObjectConfigurationException if an invalid scope has been specified | [
"Parses",
"the",
"value",
"of",
"the",
"option",
"scope"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L257-L269 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.parseAutowiring | protected static function parseAutowiring($value)
{
switch ($value) {
case true:
case Configuration::AUTOWIRING_MODE_ON:
return Configuration::AUTOWIRING_MODE_ON;
case false:
case Configuration::AUTOWIRING_MODE_OFF:
return Configuration::AUTOWIRING_MODE_OFF;
default:
throw new InvalidObjectConfigurationException('Invalid autowiring declaration', 1283866757);
}
} | php | protected static function parseAutowiring($value)
{
switch ($value) {
case true:
case Configuration::AUTOWIRING_MODE_ON:
return Configuration::AUTOWIRING_MODE_ON;
case false:
case Configuration::AUTOWIRING_MODE_OFF:
return Configuration::AUTOWIRING_MODE_OFF;
default:
throw new InvalidObjectConfigurationException('Invalid autowiring declaration', 1283866757);
}
} | [
"protected",
"static",
"function",
"parseAutowiring",
"(",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"value",
")",
"{",
"case",
"true",
":",
"case",
"Configuration",
"::",
"AUTOWIRING_MODE_ON",
":",
"return",
"Configuration",
"::",
"AUTOWIRING_MODE_ON",
";",
... | Parses the value of the option "autowiring"
@param mixed $value Value of the option
@return integer The autowiring option translated into one of Configuration::AUTOWIRING_MODE_*
@throws InvalidObjectConfigurationException if an invalid option has been specified | [
"Parses",
"the",
"value",
"of",
"the",
"option",
"autowiring"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L278-L290 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.parsePropertyOfTypeObject | protected function parsePropertyOfTypeObject($propertyName, $objectNameOrConfiguration, Configuration $parentObjectConfiguration)
{
if (is_array($objectNameOrConfiguration)) {
if (isset($objectNameOrConfiguration['name'])) {
$objectName = $objectNameOrConfiguration['name'];
unset($objectNameOrConfiguration['name']);
} else {
if (isset($objectNameOrConfiguration['factoryObjectName'])) {
$objectName = null;
} else {
$annotations = $this->reflectionService->getPropertyTagValues($parentObjectConfiguration->getClassName(), $propertyName, 'var');
if (count($annotations) !== 1) {
throw new InvalidObjectConfigurationException(sprintf('Object %s, for property "%s", contains neither object name, nor factory object name, and nor is the property properly @var - annotated.', $parentObjectConfiguration->getConfigurationSourceHint(), $propertyName, $parentObjectConfiguration->getClassName()), 1297097815);
}
$objectName = $annotations[0];
}
}
$objectConfiguration = $this->parseConfigurationArray($objectName, $objectNameOrConfiguration, $parentObjectConfiguration->getConfigurationSourceHint() . ', property "' . $propertyName . '"');
$property = new ConfigurationProperty($propertyName, $objectConfiguration, ConfigurationProperty::PROPERTY_TYPES_OBJECT);
} else {
$property = new ConfigurationProperty($propertyName, $objectNameOrConfiguration, ConfigurationProperty::PROPERTY_TYPES_OBJECT);
}
return $property;
} | php | protected function parsePropertyOfTypeObject($propertyName, $objectNameOrConfiguration, Configuration $parentObjectConfiguration)
{
if (is_array($objectNameOrConfiguration)) {
if (isset($objectNameOrConfiguration['name'])) {
$objectName = $objectNameOrConfiguration['name'];
unset($objectNameOrConfiguration['name']);
} else {
if (isset($objectNameOrConfiguration['factoryObjectName'])) {
$objectName = null;
} else {
$annotations = $this->reflectionService->getPropertyTagValues($parentObjectConfiguration->getClassName(), $propertyName, 'var');
if (count($annotations) !== 1) {
throw new InvalidObjectConfigurationException(sprintf('Object %s, for property "%s", contains neither object name, nor factory object name, and nor is the property properly @var - annotated.', $parentObjectConfiguration->getConfigurationSourceHint(), $propertyName, $parentObjectConfiguration->getClassName()), 1297097815);
}
$objectName = $annotations[0];
}
}
$objectConfiguration = $this->parseConfigurationArray($objectName, $objectNameOrConfiguration, $parentObjectConfiguration->getConfigurationSourceHint() . ', property "' . $propertyName . '"');
$property = new ConfigurationProperty($propertyName, $objectConfiguration, ConfigurationProperty::PROPERTY_TYPES_OBJECT);
} else {
$property = new ConfigurationProperty($propertyName, $objectNameOrConfiguration, ConfigurationProperty::PROPERTY_TYPES_OBJECT);
}
return $property;
} | [
"protected",
"function",
"parsePropertyOfTypeObject",
"(",
"$",
"propertyName",
",",
"$",
"objectNameOrConfiguration",
",",
"Configuration",
"$",
"parentObjectConfiguration",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"objectNameOrConfiguration",
")",
")",
"{",
"if",
... | Parses the configuration for properties of type OBJECT
@param string $propertyName Name of the property
@param mixed $objectNameOrConfiguration Value of the "object" section of the property configuration - either a string or an array
@param Configuration $parentObjectConfiguration The Configuration object this property belongs to
@return ConfigurationProperty A configuration property of type object
@throws InvalidObjectConfigurationException | [
"Parses",
"the",
"configuration",
"for",
"properties",
"of",
"type",
"OBJECT"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L301-L324 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.parseArgumentOfTypeObject | protected function parseArgumentOfTypeObject($argumentName, $objectNameOrConfiguration, $configurationSourceHint)
{
if (is_array($objectNameOrConfiguration)) {
if (isset($objectNameOrConfiguration['name'])) {
$objectName = $objectNameOrConfiguration['name'];
unset($objectNameOrConfiguration['name']);
} else {
if (isset($objectNameOrConfiguration['factoryObjectName'])) {
$objectName = null;
} else {
throw new InvalidObjectConfigurationException('Object configuration for argument "' . $argumentName . '" contains neither object name nor factory object name in ' . $configurationSourceHint, 1417431742);
}
}
$objectConfiguration = $this->parseConfigurationArray($objectName, $objectNameOrConfiguration, $configurationSourceHint . ', argument "' . $argumentName . '"');
$argument = new ConfigurationArgument($argumentName, $objectConfiguration, ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
} else {
$argument = new ConfigurationArgument($argumentName, $objectNameOrConfiguration, ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
}
return $argument;
} | php | protected function parseArgumentOfTypeObject($argumentName, $objectNameOrConfiguration, $configurationSourceHint)
{
if (is_array($objectNameOrConfiguration)) {
if (isset($objectNameOrConfiguration['name'])) {
$objectName = $objectNameOrConfiguration['name'];
unset($objectNameOrConfiguration['name']);
} else {
if (isset($objectNameOrConfiguration['factoryObjectName'])) {
$objectName = null;
} else {
throw new InvalidObjectConfigurationException('Object configuration for argument "' . $argumentName . '" contains neither object name nor factory object name in ' . $configurationSourceHint, 1417431742);
}
}
$objectConfiguration = $this->parseConfigurationArray($objectName, $objectNameOrConfiguration, $configurationSourceHint . ', argument "' . $argumentName . '"');
$argument = new ConfigurationArgument($argumentName, $objectConfiguration, ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
} else {
$argument = new ConfigurationArgument($argumentName, $objectNameOrConfiguration, ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
}
return $argument;
} | [
"protected",
"function",
"parseArgumentOfTypeObject",
"(",
"$",
"argumentName",
",",
"$",
"objectNameOrConfiguration",
",",
"$",
"configurationSourceHint",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"objectNameOrConfiguration",
")",
")",
"{",
"if",
"(",
"isset",
"... | Parses the configuration for arguments of type OBJECT
@param string $argumentName Name of the argument
@param mixed $objectNameOrConfiguration Value of the "object" section of the argument configuration - either a string or an array
@param string $configurationSourceHint A human readable hint on the original source of the configuration (for troubleshooting)
@return ConfigurationArgument A configuration argument of type object
@throws InvalidObjectConfigurationException | [
"Parses",
"the",
"configuration",
"for",
"arguments",
"of",
"type",
"OBJECT"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L335-L354 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.autowireArguments | protected function autowireArguments(array &$objectConfigurations)
{
foreach ($objectConfigurations as $objectConfiguration) {
/** @var Configuration $objectConfiguration */
if ($objectConfiguration->getClassName() === '') {
continue;
}
if ($objectConfiguration->getAutowiring() === Configuration::AUTOWIRING_MODE_OFF) {
continue;
}
$className = $objectConfiguration->getClassName();
if (!$this->reflectionService->hasMethod($className, '__construct')) {
continue;
}
$autowiringAnnotation = $this->reflectionService->getMethodAnnotation($className, '__construct', Flow\Autowiring::class);
if ($autowiringAnnotation !== null && $autowiringAnnotation->enabled === false) {
continue;
}
$arguments = $objectConfiguration->getArguments();
foreach ($this->reflectionService->getMethodParameters($className, '__construct') as $parameterName => $parameterInformation) {
$debuggingHint = '';
$index = $parameterInformation['position'] + 1;
if (!isset($arguments[$index])) {
if ($parameterInformation['optional'] === true) {
$defaultValue = (isset($parameterInformation['defaultValue'])) ? $parameterInformation['defaultValue'] : null;
$arguments[$index] = new ConfigurationArgument($index, $defaultValue, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
$arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
} elseif ($parameterInformation['class'] !== null && isset($objectConfigurations[$parameterInformation['class']])) {
$arguments[$index] = new ConfigurationArgument($index, $parameterInformation['class'], ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
} elseif ($parameterInformation['allowsNull'] === true) {
$arguments[$index] = new ConfigurationArgument($index, null, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
$arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
} elseif (interface_exists($parameterInformation['class'])) {
$debuggingHint = sprintf('No default implementation for the required interface %s was configured, therefore no specific class name could be used for this dependency. ', $parameterInformation['class']);
}
}
if (!isset($arguments[$index]) && $objectConfiguration->getScope() === Configuration::SCOPE_SINGLETON) {
throw new UnresolvedDependenciesException(sprintf('Could not autowire required constructor argument $%s for singleton class %s. %sCheck the type hint of that argument and your Objects.yaml configuration.', $parameterName, $className, $debuggingHint), 1298629392);
}
}
$objectConfiguration->setArguments($arguments);
}
} | php | protected function autowireArguments(array &$objectConfigurations)
{
foreach ($objectConfigurations as $objectConfiguration) {
/** @var Configuration $objectConfiguration */
if ($objectConfiguration->getClassName() === '') {
continue;
}
if ($objectConfiguration->getAutowiring() === Configuration::AUTOWIRING_MODE_OFF) {
continue;
}
$className = $objectConfiguration->getClassName();
if (!$this->reflectionService->hasMethod($className, '__construct')) {
continue;
}
$autowiringAnnotation = $this->reflectionService->getMethodAnnotation($className, '__construct', Flow\Autowiring::class);
if ($autowiringAnnotation !== null && $autowiringAnnotation->enabled === false) {
continue;
}
$arguments = $objectConfiguration->getArguments();
foreach ($this->reflectionService->getMethodParameters($className, '__construct') as $parameterName => $parameterInformation) {
$debuggingHint = '';
$index = $parameterInformation['position'] + 1;
if (!isset($arguments[$index])) {
if ($parameterInformation['optional'] === true) {
$defaultValue = (isset($parameterInformation['defaultValue'])) ? $parameterInformation['defaultValue'] : null;
$arguments[$index] = new ConfigurationArgument($index, $defaultValue, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
$arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
} elseif ($parameterInformation['class'] !== null && isset($objectConfigurations[$parameterInformation['class']])) {
$arguments[$index] = new ConfigurationArgument($index, $parameterInformation['class'], ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
} elseif ($parameterInformation['allowsNull'] === true) {
$arguments[$index] = new ConfigurationArgument($index, null, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
$arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
} elseif (interface_exists($parameterInformation['class'])) {
$debuggingHint = sprintf('No default implementation for the required interface %s was configured, therefore no specific class name could be used for this dependency. ', $parameterInformation['class']);
}
}
if (!isset($arguments[$index]) && $objectConfiguration->getScope() === Configuration::SCOPE_SINGLETON) {
throw new UnresolvedDependenciesException(sprintf('Could not autowire required constructor argument $%s for singleton class %s. %sCheck the type hint of that argument and your Objects.yaml configuration.', $parameterName, $className, $debuggingHint), 1298629392);
}
}
$objectConfiguration->setArguments($arguments);
}
} | [
"protected",
"function",
"autowireArguments",
"(",
"array",
"&",
"$",
"objectConfigurations",
")",
"{",
"foreach",
"(",
"$",
"objectConfigurations",
"as",
"$",
"objectConfiguration",
")",
"{",
"/** @var Configuration $objectConfiguration */",
"if",
"(",
"$",
"objectConf... | If mandatory constructor arguments have not been defined yet, this function tries to autowire
them if possible.
@param array &$objectConfigurations
@return void
@throws UnresolvedDependenciesException | [
"If",
"mandatory",
"constructor",
"arguments",
"have",
"not",
"been",
"defined",
"yet",
"this",
"function",
"tries",
"to",
"autowire",
"them",
"if",
"possible",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L364-L413 |
neos/flow-development-collection | Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.autowireProperties | protected function autowireProperties(array &$objectConfigurations)
{
/** @var Configuration $objectConfiguration */
foreach ($objectConfigurations as $objectConfiguration) {
$className = $objectConfiguration->getClassName();
$properties = $objectConfiguration->getProperties();
if ($className === '') {
continue;
}
if ($objectConfiguration->getAutowiring() === Configuration::AUTOWIRING_MODE_OFF) {
continue;
}
$classMethodNames = get_class_methods($className);
if (!is_array($classMethodNames)) {
if (!class_exists($className)) {
throw new UnknownClassException(sprintf('The class "%s" defined in the object configuration for object "%s", defined in package: %s, does not exist.', $className, $objectConfiguration->getObjectName(), $objectConfiguration->getPackageKey()), 1352371371);
} else {
throw new UnknownClassException(sprintf('Could not autowire properties of class "%s" because names of methods contained in that class could not be retrieved using get_class_methods().', $className), 1352386418);
}
}
foreach ($classMethodNames as $methodName) {
if (isset($methodName[6]) && strpos($methodName, 'inject') === 0 && $methodName[6] === strtoupper($methodName[6])) {
$propertyName = lcfirst(substr($methodName, 6));
$autowiringAnnotation = $this->reflectionService->getMethodAnnotation($className, $methodName, Flow\Autowiring::class);
if ($autowiringAnnotation !== null && $autowiringAnnotation->enabled === false) {
continue;
}
if ($methodName === 'injectSettings') {
$packageKey = $objectConfiguration->getPackageKey();
if ($packageKey !== null) {
$properties[$propertyName] = new ConfigurationProperty($propertyName, ['type' => ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'path' => $packageKey], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
}
} else {
if (array_key_exists($propertyName, $properties)) {
continue;
}
$methodParameters = $this->reflectionService->getMethodParameters($className, $methodName);
if (count($methodParameters) !== 1) {
$this->logger->debug(sprintf('Could not autowire property %s because %s() expects %s instead of exactly 1 parameter.', $className . '::' . $propertyName, $methodName, (count($methodParameters) ?: 'none')));
continue;
}
$methodParameter = array_pop($methodParameters);
if ($methodParameter['class'] === null) {
$this->logger->debug(sprintf('Could not autowire property %s because the method parameter in %s() contained no class type hint.', $className . '::' . $propertyName, $methodName));
continue;
}
$properties[$propertyName] = new ConfigurationProperty($propertyName, $methodParameter['class'], ConfigurationProperty::PROPERTY_TYPES_OBJECT);
}
}
}
foreach ($this->reflectionService->getPropertyNamesByAnnotation($className, Inject::class) as $propertyName) {
if ($this->reflectionService->isPropertyPrivate($className, $propertyName)) {
throw new ObjectException(sprintf('The property "%s" in class "%s" must not be private when annotated for injection.', $propertyName, $className), 1328109641);
}
if (!array_key_exists($propertyName, $properties)) {
/** @var Inject $injectAnnotation */
$injectAnnotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, Inject::class);
$objectName = trim(implode('', $this->reflectionService->getPropertyTagValues($className, $propertyName, 'var')), ' \\');
$configurationProperty = new ConfigurationProperty($propertyName, $objectName, ConfigurationProperty::PROPERTY_TYPES_OBJECT, null, $injectAnnotation->lazy);
$properties[$propertyName] = $configurationProperty;
}
}
foreach ($this->reflectionService->getPropertyNamesByAnnotation($className, InjectConfiguration::class) as $propertyName) {
if ($this->reflectionService->isPropertyPrivate($className, $propertyName)) {
throw new ObjectException(sprintf('The property "%s" in class "%s" must not be private when annotated for configuration injection.', $propertyName, $className), 1416765599);
}
if (array_key_exists($propertyName, $properties)) {
continue;
}
/** @var InjectConfiguration $injectConfigurationAnnotation */
$injectConfigurationAnnotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, InjectConfiguration::class);
if ($injectConfigurationAnnotation->type === ConfigurationManager::CONFIGURATION_TYPE_SETTINGS) {
$packageKey = $injectConfigurationAnnotation->package !== null ? $injectConfigurationAnnotation->package : $objectConfiguration->getPackageKey();
$configurationPath = rtrim($packageKey . '.' . $injectConfigurationAnnotation->path, '.');
} else {
if ($injectConfigurationAnnotation->package !== null) {
throw new ObjectException(sprintf('The InjectConfiguration annotation for property "%s" in class "%s" specifies a "package" key for configuration type "%s", but this is only supported for injection of "Settings".', $propertyName, $className, $injectConfigurationAnnotation->type), 1420811958);
}
$configurationPath = $injectConfigurationAnnotation->path;
}
$properties[$propertyName] = new ConfigurationProperty($propertyName, ['type' => $injectConfigurationAnnotation->type, 'path' => $configurationPath], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
}
$objectConfiguration->setProperties($properties);
}
} | php | protected function autowireProperties(array &$objectConfigurations)
{
/** @var Configuration $objectConfiguration */
foreach ($objectConfigurations as $objectConfiguration) {
$className = $objectConfiguration->getClassName();
$properties = $objectConfiguration->getProperties();
if ($className === '') {
continue;
}
if ($objectConfiguration->getAutowiring() === Configuration::AUTOWIRING_MODE_OFF) {
continue;
}
$classMethodNames = get_class_methods($className);
if (!is_array($classMethodNames)) {
if (!class_exists($className)) {
throw new UnknownClassException(sprintf('The class "%s" defined in the object configuration for object "%s", defined in package: %s, does not exist.', $className, $objectConfiguration->getObjectName(), $objectConfiguration->getPackageKey()), 1352371371);
} else {
throw new UnknownClassException(sprintf('Could not autowire properties of class "%s" because names of methods contained in that class could not be retrieved using get_class_methods().', $className), 1352386418);
}
}
foreach ($classMethodNames as $methodName) {
if (isset($methodName[6]) && strpos($methodName, 'inject') === 0 && $methodName[6] === strtoupper($methodName[6])) {
$propertyName = lcfirst(substr($methodName, 6));
$autowiringAnnotation = $this->reflectionService->getMethodAnnotation($className, $methodName, Flow\Autowiring::class);
if ($autowiringAnnotation !== null && $autowiringAnnotation->enabled === false) {
continue;
}
if ($methodName === 'injectSettings') {
$packageKey = $objectConfiguration->getPackageKey();
if ($packageKey !== null) {
$properties[$propertyName] = new ConfigurationProperty($propertyName, ['type' => ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'path' => $packageKey], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
}
} else {
if (array_key_exists($propertyName, $properties)) {
continue;
}
$methodParameters = $this->reflectionService->getMethodParameters($className, $methodName);
if (count($methodParameters) !== 1) {
$this->logger->debug(sprintf('Could not autowire property %s because %s() expects %s instead of exactly 1 parameter.', $className . '::' . $propertyName, $methodName, (count($methodParameters) ?: 'none')));
continue;
}
$methodParameter = array_pop($methodParameters);
if ($methodParameter['class'] === null) {
$this->logger->debug(sprintf('Could not autowire property %s because the method parameter in %s() contained no class type hint.', $className . '::' . $propertyName, $methodName));
continue;
}
$properties[$propertyName] = new ConfigurationProperty($propertyName, $methodParameter['class'], ConfigurationProperty::PROPERTY_TYPES_OBJECT);
}
}
}
foreach ($this->reflectionService->getPropertyNamesByAnnotation($className, Inject::class) as $propertyName) {
if ($this->reflectionService->isPropertyPrivate($className, $propertyName)) {
throw new ObjectException(sprintf('The property "%s" in class "%s" must not be private when annotated for injection.', $propertyName, $className), 1328109641);
}
if (!array_key_exists($propertyName, $properties)) {
/** @var Inject $injectAnnotation */
$injectAnnotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, Inject::class);
$objectName = trim(implode('', $this->reflectionService->getPropertyTagValues($className, $propertyName, 'var')), ' \\');
$configurationProperty = new ConfigurationProperty($propertyName, $objectName, ConfigurationProperty::PROPERTY_TYPES_OBJECT, null, $injectAnnotation->lazy);
$properties[$propertyName] = $configurationProperty;
}
}
foreach ($this->reflectionService->getPropertyNamesByAnnotation($className, InjectConfiguration::class) as $propertyName) {
if ($this->reflectionService->isPropertyPrivate($className, $propertyName)) {
throw new ObjectException(sprintf('The property "%s" in class "%s" must not be private when annotated for configuration injection.', $propertyName, $className), 1416765599);
}
if (array_key_exists($propertyName, $properties)) {
continue;
}
/** @var InjectConfiguration $injectConfigurationAnnotation */
$injectConfigurationAnnotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, InjectConfiguration::class);
if ($injectConfigurationAnnotation->type === ConfigurationManager::CONFIGURATION_TYPE_SETTINGS) {
$packageKey = $injectConfigurationAnnotation->package !== null ? $injectConfigurationAnnotation->package : $objectConfiguration->getPackageKey();
$configurationPath = rtrim($packageKey . '.' . $injectConfigurationAnnotation->path, '.');
} else {
if ($injectConfigurationAnnotation->package !== null) {
throw new ObjectException(sprintf('The InjectConfiguration annotation for property "%s" in class "%s" specifies a "package" key for configuration type "%s", but this is only supported for injection of "Settings".', $propertyName, $className, $injectConfigurationAnnotation->type), 1420811958);
}
$configurationPath = $injectConfigurationAnnotation->path;
}
$properties[$propertyName] = new ConfigurationProperty($propertyName, ['type' => $injectConfigurationAnnotation->type, 'path' => $configurationPath], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
}
$objectConfiguration->setProperties($properties);
}
} | [
"protected",
"function",
"autowireProperties",
"(",
"array",
"&",
"$",
"objectConfigurations",
")",
"{",
"/** @var Configuration $objectConfiguration */",
"foreach",
"(",
"$",
"objectConfigurations",
"as",
"$",
"objectConfiguration",
")",
"{",
"$",
"className",
"=",
"$"... | This function tries to find yet unmatched dependencies which need to be injected via "inject*" setter methods.
@param array &$objectConfigurations
@return void
@throws ObjectException if an injected property is private | [
"This",
"function",
"tries",
"to",
"find",
"yet",
"unmatched",
"dependencies",
"which",
"need",
"to",
"be",
"injected",
"via",
"inject",
"*",
"setter",
"methods",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/ObjectManagement/Configuration/ConfigurationBuilder.php#L422-L512 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.setStatusCache | public function setStatusCache(StringFrontend $cache)
{
$this->statusCache = $cache;
$backend = $this->statusCache->getBackend();
if (is_callable(['initializeObject', $backend])) {
$backend->initializeObject();
}
} | php | public function setStatusCache(StringFrontend $cache)
{
$this->statusCache = $cache;
$backend = $this->statusCache->getBackend();
if (is_callable(['initializeObject', $backend])) {
$backend->initializeObject();
}
} | [
"public",
"function",
"setStatusCache",
"(",
"StringFrontend",
"$",
"cache",
")",
"{",
"$",
"this",
"->",
"statusCache",
"=",
"$",
"cache",
";",
"$",
"backend",
"=",
"$",
"this",
"->",
"statusCache",
"->",
"getBackend",
"(",
")",
";",
"if",
"(",
"is_call... | Sets the status cache
The cache must be set before initializing the Reflection Service
@param StringFrontend $cache Cache for the reflection service
@return void | [
"Sets",
"the",
"status",
"cache"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L237-L244 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.initialize | protected function initialize()
{
$this->context = $this->environment->getContext();
if ($this->hasFrozenCacheInProduction()) {
$this->classReflectionData = $this->reflectionDataRuntimeCache->get('__classNames');
$this->annotatedClasses = $this->reflectionDataRuntimeCache->get('__annotatedClasses');
$this->loadFromClassSchemaRuntimeCache = true;
} else {
$this->loadClassReflectionCompiletimeCache();
}
$this->annotationReader = new AnnotationReader();
foreach ($this->settings['ignoredTags'] as $tagName => $ignoreFlag) {
if ($ignoreFlag === true) {
AnnotationReader::addGlobalIgnoredName($tagName);
}
}
$this->initialized = true;
} | php | protected function initialize()
{
$this->context = $this->environment->getContext();
if ($this->hasFrozenCacheInProduction()) {
$this->classReflectionData = $this->reflectionDataRuntimeCache->get('__classNames');
$this->annotatedClasses = $this->reflectionDataRuntimeCache->get('__annotatedClasses');
$this->loadFromClassSchemaRuntimeCache = true;
} else {
$this->loadClassReflectionCompiletimeCache();
}
$this->annotationReader = new AnnotationReader();
foreach ($this->settings['ignoredTags'] as $tagName => $ignoreFlag) {
if ($ignoreFlag === true) {
AnnotationReader::addGlobalIgnoredName($tagName);
}
}
$this->initialized = true;
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"$",
"this",
"->",
"context",
"=",
"$",
"this",
"->",
"environment",
"->",
"getContext",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasFrozenCacheInProduction",
"(",
")",
")",
"{",
"$",
"this",
"... | Initialize the reflection service lazily
This method must be run only after all dependencies have been injected.
@return void | [
"Initialize",
"the",
"reflection",
"service",
"lazily"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L338-L358 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.buildReflectionData | public function buildReflectionData(array $availableClassNames)
{
if (!$this->initialized) {
$this->initialize();
}
$this->availableClassNames = $availableClassNames;
$this->forgetChangedClasses();
$this->reflectEmergedClasses();
} | php | public function buildReflectionData(array $availableClassNames)
{
if (!$this->initialized) {
$this->initialize();
}
$this->availableClassNames = $availableClassNames;
$this->forgetChangedClasses();
$this->reflectEmergedClasses();
} | [
"public",
"function",
"buildReflectionData",
"(",
"array",
"$",
"availableClassNames",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"this",
"->",
"availableClassNames",
"=",... | Builds the reflection data cache during compile time.
This method is called by the CompiletimeObjectManager which also determines
the list of classes to consider for reflection.
@param array $availableClassNames List of all class names to consider for reflection
@return void | [
"Builds",
"the",
"reflection",
"data",
"cache",
"during",
"compile",
"time",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L369-L377 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isClassReflected | public function isClassReflected($className)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
return isset($this->classReflectionData[$className]);
} | php | public function isClassReflected($className)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
return isset($this->classReflectionData[$className]);
} | [
"public",
"function",
"isClassReflected",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"className",
"=",
"$",
"this",
"->",
"cleanClassName",
"(",... | Tells if the specified class is known to this reflection service and
reflection information is available.
@param string $className Name of the class
@return boolean If the class is reflected by this service
@api | [
"Tells",
"if",
"the",
"specified",
"class",
"is",
"known",
"to",
"this",
"reflection",
"service",
"and",
"reflection",
"information",
"is",
"available",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L387-L395 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getDefaultImplementationClassNameForInterface | public function getDefaultImplementationClassNameForInterface($interfaceName)
{
if (!$this->initialized) {
$this->initialize();
}
$interfaceName = $this->cleanClassName($interfaceName);
if (interface_exists($interfaceName) === false) {
throw new \InvalidArgumentException('"' . $interfaceName . '" does not exist or is not the name of an interface.', 1238769559);
}
$this->loadOrReflectClassIfNecessary($interfaceName);
$classNamesFound = isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) ? array_keys($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) : [];
if (count($classNamesFound) === 1) {
return $classNamesFound[0];
}
if (count($classNamesFound) !== 2 || !isset($this->classReflectionData[ProxyInterface::class][self::DATA_INTERFACE_IMPLEMENTATIONS])) {
return false;
}
if (isset($this->classReflectionData[ProxyInterface::class][self::DATA_INTERFACE_IMPLEMENTATIONS][$classNamesFound[0]])) {
return $classNamesFound[0];
}
if (isset($this->classReflectionData[ProxyInterface::class][self::DATA_INTERFACE_IMPLEMENTATIONS][$classNamesFound[1]])) {
return $classNamesFound[1];
}
return false;
} | php | public function getDefaultImplementationClassNameForInterface($interfaceName)
{
if (!$this->initialized) {
$this->initialize();
}
$interfaceName = $this->cleanClassName($interfaceName);
if (interface_exists($interfaceName) === false) {
throw new \InvalidArgumentException('"' . $interfaceName . '" does not exist or is not the name of an interface.', 1238769559);
}
$this->loadOrReflectClassIfNecessary($interfaceName);
$classNamesFound = isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) ? array_keys($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) : [];
if (count($classNamesFound) === 1) {
return $classNamesFound[0];
}
if (count($classNamesFound) !== 2 || !isset($this->classReflectionData[ProxyInterface::class][self::DATA_INTERFACE_IMPLEMENTATIONS])) {
return false;
}
if (isset($this->classReflectionData[ProxyInterface::class][self::DATA_INTERFACE_IMPLEMENTATIONS][$classNamesFound[0]])) {
return $classNamesFound[0];
}
if (isset($this->classReflectionData[ProxyInterface::class][self::DATA_INTERFACE_IMPLEMENTATIONS][$classNamesFound[1]])) {
return $classNamesFound[1];
}
return false;
} | [
"public",
"function",
"getDefaultImplementationClassNameForInterface",
"(",
"$",
"interfaceName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"interfaceName",
"=",
"$",
"this... | Searches for and returns the class name of the default implementation of the given
interface name. If no class implementing the interface was found or more than one
implementation was found in the package defining the interface, false is returned.
@param string $interfaceName Name of the interface
@return mixed Either the class name of the default implementation for the object type or false
@throws \InvalidArgumentException if the given interface does not exist
@api | [
"Searches",
"for",
"and",
"returns",
"the",
"class",
"name",
"of",
"the",
"default",
"implementation",
"of",
"the",
"given",
"interface",
"name",
".",
"If",
"no",
"class",
"implementing",
"the",
"interface",
"was",
"found",
"or",
"more",
"than",
"one",
"impl... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L422-L450 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getAllImplementationClassNamesForInterface | public function getAllImplementationClassNamesForInterface($interfaceName)
{
if (!$this->initialized) {
$this->initialize();
}
$interfaceName = $this->cleanClassName($interfaceName);
if (interface_exists($interfaceName) === false) {
throw new \InvalidArgumentException('"' . $interfaceName . '" does not exist or is not the name of an interface.', 1238769560);
}
$this->loadOrReflectClassIfNecessary($interfaceName);
return (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS])) ? array_keys($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) : [];
} | php | public function getAllImplementationClassNamesForInterface($interfaceName)
{
if (!$this->initialized) {
$this->initialize();
}
$interfaceName = $this->cleanClassName($interfaceName);
if (interface_exists($interfaceName) === false) {
throw new \InvalidArgumentException('"' . $interfaceName . '" does not exist or is not the name of an interface.', 1238769560);
}
$this->loadOrReflectClassIfNecessary($interfaceName);
return (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS])) ? array_keys($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) : [];
} | [
"public",
"function",
"getAllImplementationClassNamesForInterface",
"(",
"$",
"interfaceName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"interfaceName",
"=",
"$",
"this",
... | Searches for and returns all class names of implementations of the given object type
(interface name). If no class implementing the interface was found, an empty array is returned.
@param string $interfaceName Name of the interface
@return array An array of class names of the default implementation for the object type
@throws \InvalidArgumentException if the given interface does not exist
@api | [
"Searches",
"for",
"and",
"returns",
"all",
"class",
"names",
"of",
"implementations",
"of",
"the",
"given",
"object",
"type",
"(",
"interface",
"name",
")",
".",
"If",
"no",
"class",
"implementing",
"the",
"interface",
"was",
"found",
"an",
"empty",
"array"... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L461-L474 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getAllSubClassNamesForClass | public function getAllSubClassNamesForClass($className)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
if (class_exists($className) === false) {
throw new \InvalidArgumentException('"' . $className . '" does not exist or is not the name of a class.', 1257168042);
}
$this->loadOrReflectClassIfNecessary($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES])) ? array_keys($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES]) : [];
} | php | public function getAllSubClassNamesForClass($className)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
if (class_exists($className) === false) {
throw new \InvalidArgumentException('"' . $className . '" does not exist or is not the name of a class.', 1257168042);
}
$this->loadOrReflectClassIfNecessary($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES])) ? array_keys($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES]) : [];
} | [
"public",
"function",
"getAllSubClassNamesForClass",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"className",
"=",
"$",
"this",
"->",
"cleanClassNa... | Searches for and returns all names of classes inheriting the specified class.
If no class inheriting the given class was found, an empty array is returned.
@param string $className Name of the parent class
@return array An array of names of those classes being a direct or indirect subclass of the specified class
@throws \InvalidArgumentException if the given class does not exist
@api | [
"Searches",
"for",
"and",
"returns",
"all",
"names",
"of",
"classes",
"inheriting",
"the",
"specified",
"class",
".",
"If",
"no",
"class",
"inheriting",
"the",
"given",
"class",
"was",
"found",
"an",
"empty",
"array",
"is",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L485-L498 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getClassNamesByAnnotation | public function getClassNamesByAnnotation($annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$annotationClassName = $this->cleanClassName($annotationClassName);
return (isset($this->annotatedClasses[$annotationClassName]) ? array_keys($this->annotatedClasses[$annotationClassName]) : []);
} | php | public function getClassNamesByAnnotation($annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$annotationClassName = $this->cleanClassName($annotationClassName);
return (isset($this->annotatedClasses[$annotationClassName]) ? array_keys($this->annotatedClasses[$annotationClassName]) : []);
} | [
"public",
"function",
"getClassNamesByAnnotation",
"(",
"$",
"annotationClassName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"annotationClassName",
"=",
"$",
"this",
"->... | Searches for and returns all names of classes which are tagged by the specified
annotation. If no classes were found, an empty array is returned.
@param string $annotationClassName Name of the annotation class, for example "Neos\Flow\Annotations\Aspect"
@return array | [
"Searches",
"for",
"and",
"returns",
"all",
"names",
"of",
"classes",
"which",
"are",
"tagged",
"by",
"the",
"specified",
"annotation",
".",
"If",
"no",
"classes",
"were",
"found",
"an",
"empty",
"array",
"is",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L507-L515 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isClassAnnotatedWith | public function isClassAnnotatedWith($className, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
$annotationClassName = $this->cleanClassName($annotationClassName);
return (isset($this->annotatedClasses[$annotationClassName][$className]));
} | php | public function isClassAnnotatedWith($className, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
$annotationClassName = $this->cleanClassName($annotationClassName);
return (isset($this->annotatedClasses[$annotationClassName][$className]));
} | [
"public",
"function",
"isClassAnnotatedWith",
"(",
"$",
"className",
",",
"$",
"annotationClassName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"className",
"=",
"$",
... | Tells if the specified class has the given annotation
@param string $className Name of the class
@param string $annotationClassName Annotation to check for
@return boolean
@api | [
"Tells",
"if",
"the",
"specified",
"class",
"has",
"the",
"given",
"annotation"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L525-L535 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getClassAnnotations | public function getClassAnnotations($className, $annotationClassName = null)
{
$className = $this->prepareClassReflectionForUsage($className);
$annotationClassName = $annotationClassName === null ? null : $this->cleanClassName($annotationClassName);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS])) {
return [];
}
if ($annotationClassName === null) {
return $this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS];
}
$annotations = [];
foreach ($this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS] as $annotation) {
if ($annotation instanceof $annotationClassName) {
$annotations[] = $annotation;
}
}
return $annotations;
} | php | public function getClassAnnotations($className, $annotationClassName = null)
{
$className = $this->prepareClassReflectionForUsage($className);
$annotationClassName = $annotationClassName === null ? null : $this->cleanClassName($annotationClassName);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS])) {
return [];
}
if ($annotationClassName === null) {
return $this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS];
}
$annotations = [];
foreach ($this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS] as $annotation) {
if ($annotation instanceof $annotationClassName) {
$annotations[] = $annotation;
}
}
return $annotations;
} | [
"public",
"function",
"getClassAnnotations",
"(",
"$",
"className",
",",
"$",
"annotationClassName",
"=",
"null",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"$",
"annotationClassName",
"... | Returns the specified class annotations or an empty array
@param string $className Name of the class
@param string $annotationClassName Annotation to filter for
@return array<object> | [
"Returns",
"the",
"specified",
"class",
"annotations",
"or",
"an",
"empty",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L544-L564 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getClassAnnotation | public function getClassAnnotation($className, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$annotations = $this->getClassAnnotations($className, $annotationClassName);
return $annotations === [] ? null : current($annotations);
} | php | public function getClassAnnotation($className, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$annotations = $this->getClassAnnotations($className, $annotationClassName);
return $annotations === [] ? null : current($annotations);
} | [
"public",
"function",
"getClassAnnotation",
"(",
"$",
"className",
",",
"$",
"annotationClassName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"annotations",
"=",
"$",
... | Returns the specified class annotation or NULL.
If multiple annotations are set on the target you will
get one (random) instance of them.
@param string $className Name of the class
@param string $annotationClassName Annotation to filter for
@return object | [
"Returns",
"the",
"specified",
"class",
"annotation",
"or",
"NULL",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L576-L584 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isClassImplementationOf | public function isClassImplementationOf($className, $interfaceName)
{
$className = $this->prepareClassReflectionForUsage($className);
$interfaceName = $this->cleanClassName($interfaceName);
$this->loadOrReflectClassIfNecessary($interfaceName);
return (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className]));
} | php | public function isClassImplementationOf($className, $interfaceName)
{
$className = $this->prepareClassReflectionForUsage($className);
$interfaceName = $this->cleanClassName($interfaceName);
$this->loadOrReflectClassIfNecessary($interfaceName);
return (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className]));
} | [
"public",
"function",
"isClassImplementationOf",
"(",
"$",
"className",
",",
"$",
"interfaceName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"$",
"interfaceName",
"=",
"$",
"this",
"-... | Tells if the specified class implements the given interface
@param string $className Name of the class
@param string $interfaceName interface to check for
@return boolean true if the class implements $interfaceName, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"class",
"implements",
"the",
"given",
"interface"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L594-L602 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isClassAbstract | public function isClassAbstract($className)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_ABSTRACT]);
} | php | public function isClassAbstract($className)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_ABSTRACT]);
} | [
"public",
"function",
"isClassAbstract",
"(",
"$",
"className",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"classReflectionData",
"[",
"$",
... | Tells if the specified class is abstract or not
@param string $className Name of the class to analyze
@return boolean true if the class is abstract, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"class",
"is",
"abstract",
"or",
"not"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L611-L615 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isClassFinal | public function isClassFinal($className)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_FINAL]);
} | php | public function isClassFinal($className)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_FINAL]);
} | [
"public",
"function",
"isClassFinal",
"(",
"$",
"className",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"classReflectionData",
"[",
"$",
"c... | Tells if the specified class is final or not
@param string $className Name of the class to analyze
@return boolean true if the class is final, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"class",
"is",
"final",
"or",
"not"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L624-L628 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getClassesContainingMethodsAnnotatedWith | public function getClassesContainingMethodsAnnotatedWith($annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
return isset($this->classesByMethodAnnotations[$annotationClassName]) ? array_keys($this->classesByMethodAnnotations[$annotationClassName]) : [];
} | php | public function getClassesContainingMethodsAnnotatedWith($annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
return isset($this->classesByMethodAnnotations[$annotationClassName]) ? array_keys($this->classesByMethodAnnotations[$annotationClassName]) : [];
} | [
"public",
"function",
"getClassesContainingMethodsAnnotatedWith",
"(",
"$",
"annotationClassName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"return",
"isset",
"(",
"$",
"this",... | Returns all class names of classes containing at least one method annotated
with the given annotation class
@param string $annotationClassName The annotation class name for a method annotation
@return array An array of class names
@api | [
"Returns",
"all",
"class",
"names",
"of",
"classes",
"containing",
"at",
"least",
"one",
"method",
"annotated",
"with",
"the",
"given",
"annotation",
"class"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L652-L659 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getMethodsAnnotatedWith | public function getMethodsAnnotatedWith($className, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
return isset($this->classesByMethodAnnotations[$annotationClassName][$className]) ? $this->classesByMethodAnnotations[$annotationClassName][$className] : [];
} | php | public function getMethodsAnnotatedWith($className, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
return isset($this->classesByMethodAnnotations[$annotationClassName][$className]) ? $this->classesByMethodAnnotations[$annotationClassName][$className] : [];
} | [
"public",
"function",
"getMethodsAnnotatedWith",
"(",
"$",
"className",
",",
"$",
"annotationClassName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"return",
"isset",
"(",
"$... | Returns all names of methods of the given class that are annotated with the given annotation class
@param string $className Name of the class containing the method(s)
@param string $annotationClassName The annotation class name for a method annotation
@return array An array of method names
@api | [
"Returns",
"all",
"names",
"of",
"methods",
"of",
"the",
"given",
"class",
"that",
"are",
"annotated",
"with",
"the",
"given",
"annotation",
"class"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L669-L675 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isMethodFinal | public function isMethodFinal($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_FINAL]);
} | php | public function isMethodFinal($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_FINAL]);
} | [
"public",
"function",
"isMethodFinal",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"classRefl... | Tells if the specified method is final or not
@param string $className Name of the class containing the method
@param string $methodName Name of the method to analyze
@return boolean true if the method is final, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"method",
"is",
"final",
"or",
"not"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L685-L689 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isMethodStatic | public function isMethodStatic($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_STATIC]);
} | php | public function isMethodStatic($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_STATIC]);
} | [
"public",
"function",
"isMethodStatic",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"classRef... | Tells if the specified method is declared as static or not
@param string $className Name of the class containing the method
@param string $methodName Name of the method to analyze
@return boolean true if the method is static, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"method",
"is",
"declared",
"as",
"static",
"or",
"not"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L699-L703 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isMethodPublic | public function isMethodPublic($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY]) && $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY] === self::VISIBILITY_PUBLIC);
} | php | public function isMethodPublic($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY]) && $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY] === self::VISIBILITY_PUBLIC);
} | [
"public",
"function",
"isMethodPublic",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"c... | Tells if the specified method is public
@param string $className Name of the class containing the method
@param string $methodName Name of the method to analyze
@return boolean true if the method is public, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"method",
"is",
"public"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L713-L717 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isMethodProtected | public function isMethodProtected($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY]) && $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY] === self::VISIBILITY_PROTECTED);
} | php | public function isMethodProtected($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY]) && $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY] === self::VISIBILITY_PROTECTED);
} | [
"public",
"function",
"isMethodProtected",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
... | Tells if the specified method is protected
@param string $className Name of the class containing the method
@param string $methodName Name of the method to analyze
@return boolean true if the method is protected, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"method",
"is",
"protected"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L727-L731 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isMethodPrivate | public function isMethodPrivate($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY]) && $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY] === self::VISIBILITY_PRIVATE);
} | php | public function isMethodPrivate($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY]) && $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY] === self::VISIBILITY_PRIVATE);
} | [
"public",
"function",
"isMethodPrivate",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"... | Tells if the specified method is private
@param string $className Name of the class containing the method
@param string $methodName Name of the method to analyze
@return boolean true if the method is private, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"method",
"is",
"private"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L741-L745 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isMethodTaggedWith | public function isMethodTaggedWith($className, $methodName, $tag)
{
if (!$this->initialized) {
$this->initialize();
}
$method = new MethodReflection($this->cleanClassName($className), $methodName);
$tagsValues = $method->getTagsValues();
return isset($tagsValues[$tag]);
} | php | public function isMethodTaggedWith($className, $methodName, $tag)
{
if (!$this->initialized) {
$this->initialize();
}
$method = new MethodReflection($this->cleanClassName($className), $methodName);
$tagsValues = $method->getTagsValues();
return isset($tagsValues[$tag]);
} | [
"public",
"function",
"isMethodTaggedWith",
"(",
"$",
"className",
",",
"$",
"methodName",
",",
"$",
"tag",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"method",
"=",... | Tells if the specified method is tagged with the given tag
@param string $className Name of the class containing the method
@param string $methodName Name of the method to analyze
@param string $tag Tag to check for
@return boolean true if the method is tagged with $tag, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"method",
"is",
"tagged",
"with",
"the",
"given",
"tag"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L756-L765 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getMethodAnnotations | public function getMethodAnnotations($className, $methodName, $annotationClassName = null)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
$annotationClassName = $annotationClassName === null ? null : $this->cleanClassName($annotationClassName);
$annotations = [];
$methodAnnotations = $this->annotationReader->getMethodAnnotations(new MethodReflection($className, $methodName));
if ($annotationClassName === null) {
return $methodAnnotations;
}
foreach ($methodAnnotations as $annotation) {
if ($annotation instanceof $annotationClassName) {
$annotations[] = $annotation;
}
}
return $annotations;
} | php | public function getMethodAnnotations($className, $methodName, $annotationClassName = null)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
$annotationClassName = $annotationClassName === null ? null : $this->cleanClassName($annotationClassName);
$annotations = [];
$methodAnnotations = $this->annotationReader->getMethodAnnotations(new MethodReflection($className, $methodName));
if ($annotationClassName === null) {
return $methodAnnotations;
}
foreach ($methodAnnotations as $annotation) {
if ($annotation instanceof $annotationClassName) {
$annotations[] = $annotation;
}
}
return $annotations;
} | [
"public",
"function",
"getMethodAnnotations",
"(",
"$",
"className",
",",
"$",
"methodName",
",",
"$",
"annotationClassName",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";... | Returns the specified method annotations or an empty array
@param string $className Name of the class
@param string $methodName Name of the method
@param string $annotationClassName Annotation to filter for
@return array<object>
@api | [
"Returns",
"the",
"specified",
"method",
"annotations",
"or",
"an",
"empty",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L790-L811 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getMethodAnnotation | public function getMethodAnnotation($className, $methodName, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$annotations = $this->getMethodAnnotations($className, $methodName, $annotationClassName);
return $annotations === [] ? null : current($annotations);
} | php | public function getMethodAnnotation($className, $methodName, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$annotations = $this->getMethodAnnotations($className, $methodName, $annotationClassName);
return $annotations === [] ? null : current($annotations);
} | [
"public",
"function",
"getMethodAnnotation",
"(",
"$",
"className",
",",
"$",
"methodName",
",",
"$",
"annotationClassName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
... | Returns the specified method annotation or NULL.
If multiple annotations are set on the target you will
get one (random) instance of them.
@param string $className Name of the class
@param string $methodName Name of the method
@param string $annotationClassName Annotation to filter for
@return object | [
"Returns",
"the",
"specified",
"method",
"annotation",
"or",
"NULL",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L824-L832 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getClassPropertyNames | public function getClassPropertyNames($className)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES]) ? array_keys($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES]) : [];
} | php | public function getClassPropertyNames($className)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES]) ? array_keys($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES]) : [];
} | [
"public",
"function",
"getClassPropertyNames",
"(",
"$",
"className",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"classReflectionData",
"[",
... | Returns the names of all properties of the specified class
@param string $className Name of the class to return the property names of
@return array An array of property names or an empty array if none exist
@api | [
"Returns",
"the",
"names",
"of",
"all",
"properties",
"of",
"the",
"specified",
"class"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L841-L845 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.hasMethod | public function hasMethod($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName]);
} | php | public function hasMethod($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName]);
} | [
"public",
"function",
"hasMethod",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"classReflecti... | Wrapper for method_exists() which tells if the given method exists.
@param string $className Name of the class containing the method
@param string $methodName Name of the method
@return boolean
@api | [
"Wrapper",
"for",
"method_exists",
"()",
"which",
"tells",
"if",
"the",
"given",
"method",
"exists",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L855-L859 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getMethodTagsValues | public function getMethodTagsValues($className, $methodName)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
$method = new MethodReflection($className, $methodName);
return $method->getTagsValues();
} | php | public function getMethodTagsValues($className, $methodName)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
$method = new MethodReflection($className, $methodName);
return $method->getTagsValues();
} | [
"public",
"function",
"getMethodTagsValues",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"className",
"=",
"$",
"this",
... | Returns all tags and their values the specified method is tagged with
@param string $className Name of the class containing the method
@param string $methodName Name of the method to return the tags and values of
@return array An array of tags and their values or an empty array of no tags were found
@api | [
"Returns",
"all",
"tags",
"and",
"their",
"values",
"the",
"specified",
"method",
"is",
"tagged",
"with"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L869-L879 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getMethodParameters | public function getMethodParameters($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_PARAMETERS])) {
return [];
}
return $this->convertParameterDataToArray($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_PARAMETERS]);
} | php | public function getMethodParameters($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_PARAMETERS])) {
return [];
}
return $this->convertParameterDataToArray($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_PARAMETERS]);
} | [
"public",
"function",
"getMethodParameters",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"-... | Returns an array of parameters of the given method. Each entry contains
additional information about the parameter position, type hint etc.
@param string $className Name of the class containing the method
@param string $methodName Name of the method to return parameter information of
@return array An array of parameter names and additional information or an empty array of no parameters were found
@api | [
"Returns",
"an",
"array",
"of",
"parameters",
"of",
"the",
"given",
"method",
".",
"Each",
"entry",
"contains",
"additional",
"information",
"about",
"the",
"parameter",
"position",
"type",
"hint",
"etc",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L890-L898 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getMethodDeclaredReturnType | public function getMethodDeclaredReturnType($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_DECLARED_RETURN_TYPE])) {
return null;
}
return $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_DECLARED_RETURN_TYPE];
} | php | public function getMethodDeclaredReturnType($className, $methodName)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_DECLARED_RETURN_TYPE])) {
return null;
}
return $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_DECLARED_RETURN_TYPE];
} | [
"public",
"function",
"getMethodDeclaredReturnType",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"thi... | Returns the declared return type of a method (for PHP < 7.0 this will always return null)
@param string $className
@param string $methodName
@return string The declared return type of the method or null if none was declared | [
"Returns",
"the",
"declared",
"return",
"type",
"of",
"a",
"method",
"(",
"for",
"PHP",
"<",
"7",
".",
"0",
"this",
"will",
"always",
"return",
"null",
")"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L907-L915 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getPropertyNamesByTag | public function getPropertyNamesByTag($className, $tag)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES])) {
return [];
}
$propertyNames = [];
foreach ($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES] as $propertyName => $propertyData) {
if (isset($propertyData[self::DATA_PROPERTY_TAGS_VALUES][$tag])) {
$propertyNames[$propertyName] = true;
}
}
return array_keys($propertyNames);
} | php | public function getPropertyNamesByTag($className, $tag)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES])) {
return [];
}
$propertyNames = [];
foreach ($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES] as $propertyName => $propertyData) {
if (isset($propertyData[self::DATA_PROPERTY_TAGS_VALUES][$tag])) {
$propertyNames[$propertyName] = true;
}
}
return array_keys($propertyNames);
} | [
"public",
"function",
"getPropertyNamesByTag",
"(",
"$",
"className",
",",
"$",
"tag",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
... | Searches for and returns all names of class properties which are tagged by the specified tag.
If no properties were found, an empty array is returned.
@param string $className Name of the class containing the properties
@param string $tag Tag to search for
@return array An array of property names tagged by the tag
@api | [
"Searches",
"for",
"and",
"returns",
"all",
"names",
"of",
"class",
"properties",
"which",
"are",
"tagged",
"by",
"the",
"specified",
"tag",
".",
"If",
"no",
"properties",
"were",
"found",
"an",
"empty",
"array",
"is",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L926-L941 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getPropertyTagsValues | public function getPropertyTagsValues($className, $propertyName)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName])) {
return [];
}
return (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES])) ? $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES] : [];
} | php | public function getPropertyTagsValues($className, $propertyName)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName])) {
return [];
}
return (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES])) ? $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES] : [];
} | [
"public",
"function",
"getPropertyTagsValues",
"(",
"$",
"className",
",",
"$",
"propertyName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
... | Returns all tags and their values the specified class property is tagged with
@param string $className Name of the class containing the property
@param string $propertyName Name of the property to return the tags and values of
@return array An array of tags and their values or an empty array of no tags were found
@api | [
"Returns",
"all",
"tags",
"and",
"their",
"values",
"the",
"specified",
"class",
"property",
"is",
"tagged",
"with"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L951-L959 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getPropertyTagValues | public function getPropertyTagValues($className, $propertyName, $tag)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName])) {
return [];
}
return (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES][$tag])) ? $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES][$tag] : [];
} | php | public function getPropertyTagValues($className, $propertyName, $tag)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName])) {
return [];
}
return (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES][$tag])) ? $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES][$tag] : [];
} | [
"public",
"function",
"getPropertyTagValues",
"(",
"$",
"className",
",",
"$",
"propertyName",
",",
"$",
"tag",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"if",
"(",
"!",
"isset",
... | Returns the values of the specified class property tag
@param string $className Name of the class containing the property
@param string $propertyName Name of the tagged property
@param string $tag Tag to return the values of
@return array An array of values or an empty array if the tag was not found
@api | [
"Returns",
"the",
"values",
"of",
"the",
"specified",
"class",
"property",
"tag"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L970-L978 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isPropertyPrivate | public function isPropertyPrivate($className, $propertyName)
{
$className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_VISIBILITY])
&& $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_VISIBILITY] === self::VISIBILITY_PRIVATE);
} | php | public function isPropertyPrivate($className, $propertyName)
{
$className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_VISIBILITY])
&& $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_VISIBILITY] === self::VISIBILITY_PRIVATE);
} | [
"public",
"function",
"isPropertyPrivate",
"(",
"$",
"className",
",",
"$",
"propertyName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",... | Tells if the specified property is private
@param string $className Name of the class containing the method
@param string $propertyName Name of the property to analyze
@return boolean true if the property is private, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"property",
"is",
"private"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L988-L993 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isPropertyTaggedWith | public function isPropertyTaggedWith($className, $propertyName, $tag)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES][$tag]);
} | php | public function isPropertyTaggedWith($className, $propertyName, $tag)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_TAGS_VALUES][$tag]);
} | [
"public",
"function",
"isPropertyTaggedWith",
"(",
"$",
"className",
",",
"$",
"propertyName",
",",
"$",
"tag",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"isset",
"(",
"$"... | Tells if the specified class property is tagged with the given tag
@param string $className Name of the class
@param string $propertyName Name of the property
@param string $tag Tag to check for
@return boolean true if the class property is tagged with $tag, otherwise false
@api | [
"Tells",
"if",
"the",
"specified",
"class",
"property",
"is",
"tagged",
"with",
"the",
"given",
"tag"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1004-L1008 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isPropertyAnnotatedWith | public function isPropertyAnnotatedWith($className, $propertyName, $annotationClassName)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName]);
} | php | public function isPropertyAnnotatedWith($className, $propertyName, $annotationClassName)
{
$className = $this->prepareClassReflectionForUsage($className);
return isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName]);
} | [
"public",
"function",
"isPropertyAnnotatedWith",
"(",
"$",
"className",
",",
"$",
"propertyName",
",",
"$",
"annotationClassName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"return",
"i... | Tells if the specified property has the given annotation
@param string $className Name of the class
@param string $propertyName Name of the method
@param string $annotationClassName Annotation to check for
@return boolean
@api | [
"Tells",
"if",
"the",
"specified",
"property",
"has",
"the",
"given",
"annotation"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1019-L1023 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getPropertyNamesByAnnotation | public function getPropertyNamesByAnnotation($className, $annotationClassName)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES])) {
return [];
}
$propertyNames = [];
foreach ($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES] as $propertyName => $propertyData) {
if (isset($propertyData[self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName])) {
$propertyNames[$propertyName] = true;
}
}
return array_keys($propertyNames);
} | php | public function getPropertyNamesByAnnotation($className, $annotationClassName)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES])) {
return [];
}
$propertyNames = [];
foreach ($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES] as $propertyName => $propertyData) {
if (isset($propertyData[self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName])) {
$propertyNames[$propertyName] = true;
}
}
return array_keys($propertyNames);
} | [
"public",
"function",
"getPropertyNamesByAnnotation",
"(",
"$",
"className",
",",
"$",
"annotationClassName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"... | Searches for and returns all names of class properties which are marked by the
specified annotation. If no properties were found, an empty array is returned.
@param string $className Name of the class containing the properties
@param string $annotationClassName Class name of the annotation to search for
@return array An array of property names carrying the annotation
@api | [
"Searches",
"for",
"and",
"returns",
"all",
"names",
"of",
"class",
"properties",
"which",
"are",
"marked",
"by",
"the",
"specified",
"annotation",
".",
"If",
"no",
"properties",
"were",
"found",
"an",
"empty",
"array",
"is",
"returned",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1034-L1049 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getPropertyAnnotations | public function getPropertyAnnotations($className, $propertyName, $annotationClassName = null)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS])) {
return [];
}
if ($annotationClassName === null) {
return $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS];
}
if (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName])) {
return $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName];
}
return [];
} | php | public function getPropertyAnnotations($className, $propertyName, $annotationClassName = null)
{
$className = $this->prepareClassReflectionForUsage($className);
if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS])) {
return [];
}
if ($annotationClassName === null) {
return $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS];
}
if (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName])) {
return $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName];
}
return [];
} | [
"public",
"function",
"getPropertyAnnotations",
"(",
"$",
"className",
",",
"$",
"propertyName",
",",
"$",
"annotationClassName",
"=",
"null",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
";",
... | Returns the specified property annotations or an empty array
@param string $className Name of the class
@param string $propertyName Name of the property
@param string $annotationClassName Annotation to filter for
@return array<object>
@api | [
"Returns",
"the",
"specified",
"property",
"annotations",
"or",
"an",
"empty",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1060-L1076 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getPropertyAnnotation | public function getPropertyAnnotation($className, $propertyName, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$annotations = $this->getPropertyAnnotations($className, $propertyName, $annotationClassName);
return $annotations === [] ? null : current($annotations);
} | php | public function getPropertyAnnotation($className, $propertyName, $annotationClassName)
{
if (!$this->initialized) {
$this->initialize();
}
$annotations = $this->getPropertyAnnotations($className, $propertyName, $annotationClassName);
return $annotations === [] ? null : current($annotations);
} | [
"public",
"function",
"getPropertyAnnotation",
"(",
"$",
"className",
",",
"$",
"propertyName",
",",
"$",
"annotationClassName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$... | Returns the specified property annotation or NULL.
If multiple annotations are set on the target you will
get one (random) instance of them.
@param string $className Name of the class
@param string $propertyName Name of the property
@param string $annotationClassName Annotation to filter for
@return object | [
"Returns",
"the",
"specified",
"property",
"annotation",
"or",
"NULL",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1089-L1097 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getClassSchema | public function getClassSchema($classNameOrObject)
{
$className = $classNameOrObject;
if (is_object($classNameOrObject)) {
$className = TypeHandling::getTypeForValue($classNameOrObject);
}
$className = $this->cleanClassName($className);
if (!isset($this->classSchemata[$className])) {
$this->classSchemata[$className] = $this->classSchemataRuntimeCache->get($this->produceCacheIdentifierFromClassName($className));
}
return is_object($this->classSchemata[$className]) ? $this->classSchemata[$className] : null;
} | php | public function getClassSchema($classNameOrObject)
{
$className = $classNameOrObject;
if (is_object($classNameOrObject)) {
$className = TypeHandling::getTypeForValue($classNameOrObject);
}
$className = $this->cleanClassName($className);
if (!isset($this->classSchemata[$className])) {
$this->classSchemata[$className] = $this->classSchemataRuntimeCache->get($this->produceCacheIdentifierFromClassName($className));
}
return is_object($this->classSchemata[$className]) ? $this->classSchemata[$className] : null;
} | [
"public",
"function",
"getClassSchema",
"(",
"$",
"classNameOrObject",
")",
"{",
"$",
"className",
"=",
"$",
"classNameOrObject",
";",
"if",
"(",
"is_object",
"(",
"$",
"classNameOrObject",
")",
")",
"{",
"$",
"className",
"=",
"TypeHandling",
"::",
"getTypeFo... | Returns the class schema for the given class
@param mixed $classNameOrObject The class name or an object
@return ClassSchema | [
"Returns",
"the",
"class",
"schema",
"for",
"the",
"given",
"class"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1105-L1118 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.prepareClassReflectionForUsage | protected function prepareClassReflectionForUsage($className)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
$this->loadOrReflectClassIfNecessary($className);
return $className;
} | php | protected function prepareClassReflectionForUsage($className)
{
if (!$this->initialized) {
$this->initialize();
}
$className = $this->cleanClassName($className);
$this->loadOrReflectClassIfNecessary($className);
return $className;
} | [
"protected",
"function",
"prepareClassReflectionForUsage",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"className",
"=",
"$",
"this",
"->",
"cleanC... | Initializes the ReflectionService, cleans the given class name and finally reflects the class if necessary.
@param string $className
@return string The cleaned class name | [
"Initializes",
"the",
"ReflectionService",
"cleans",
"the",
"given",
"class",
"name",
"and",
"finally",
"reflects",
"the",
"class",
"if",
"necessary",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1126-L1135 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.reflectEmergedClasses | protected function reflectEmergedClasses()
{
$classNamesToReflect = [];
foreach ($this->availableClassNames as $classNamesInOnePackage) {
$classNamesToReflect = array_merge($classNamesToReflect, $classNamesInOnePackage);
}
$reflectedClassNames = array_keys($this->classReflectionData);
sort($classNamesToReflect);
sort($reflectedClassNames);
$newClassNames = array_diff($classNamesToReflect, $reflectedClassNames);
if ($newClassNames === []) {
return;
}
$this->log('Reflected class names did not match class names to reflect', LogLevel::DEBUG);
$count = 0;
$classNameFilterFunction = function ($className) use (&$count) {
$this->reflectClass($className);
if (
!$this->isClassAnnotatedWith($className, Flow\Entity::class) &&
!$this->isClassAnnotatedWith($className, ORM\Entity::class) &&
!$this->isClassAnnotatedWith($className, ORM\Embeddable::class) &&
!$this->isClassAnnotatedWith($className, Flow\ValueObject::class)
) {
return false;
}
$scopeAnnotation = $this->getClassAnnotation($className, Flow\Scope::class);
if ($scopeAnnotation !== null && $scopeAnnotation->value !== 'prototype') {
throw new Exception(sprintf('Classes tagged as entity or value object must be of scope prototype, however, %s is declared as %s.', $className, $scopeAnnotation->value), 1264103349);
}
$count++;
return true;
};
$classNamesToBuildSchemaFor = array_filter($newClassNames, $classNameFilterFunction);
$this->buildClassSchemata($classNamesToBuildSchemaFor);
if ($count > 0) {
$this->log(sprintf('Reflected %s emerged classes.', $count), LogLevel::INFO);
}
} | php | protected function reflectEmergedClasses()
{
$classNamesToReflect = [];
foreach ($this->availableClassNames as $classNamesInOnePackage) {
$classNamesToReflect = array_merge($classNamesToReflect, $classNamesInOnePackage);
}
$reflectedClassNames = array_keys($this->classReflectionData);
sort($classNamesToReflect);
sort($reflectedClassNames);
$newClassNames = array_diff($classNamesToReflect, $reflectedClassNames);
if ($newClassNames === []) {
return;
}
$this->log('Reflected class names did not match class names to reflect', LogLevel::DEBUG);
$count = 0;
$classNameFilterFunction = function ($className) use (&$count) {
$this->reflectClass($className);
if (
!$this->isClassAnnotatedWith($className, Flow\Entity::class) &&
!$this->isClassAnnotatedWith($className, ORM\Entity::class) &&
!$this->isClassAnnotatedWith($className, ORM\Embeddable::class) &&
!$this->isClassAnnotatedWith($className, Flow\ValueObject::class)
) {
return false;
}
$scopeAnnotation = $this->getClassAnnotation($className, Flow\Scope::class);
if ($scopeAnnotation !== null && $scopeAnnotation->value !== 'prototype') {
throw new Exception(sprintf('Classes tagged as entity or value object must be of scope prototype, however, %s is declared as %s.', $className, $scopeAnnotation->value), 1264103349);
}
$count++;
return true;
};
$classNamesToBuildSchemaFor = array_filter($newClassNames, $classNameFilterFunction);
$this->buildClassSchemata($classNamesToBuildSchemaFor);
if ($count > 0) {
$this->log(sprintf('Reflected %s emerged classes.', $count), LogLevel::INFO);
}
} | [
"protected",
"function",
"reflectEmergedClasses",
"(",
")",
"{",
"$",
"classNamesToReflect",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"availableClassNames",
"as",
"$",
"classNamesInOnePackage",
")",
"{",
"$",
"classNamesToReflect",
"=",
"array_merge"... | Checks if the given class names match those which already have been
reflected. If the given array contains class names not yet known to
this service, these classes will be reflected.
@return void
@throws Exception | [
"Checks",
"if",
"the",
"given",
"class",
"names",
"match",
"those",
"which",
"already",
"have",
"been",
"reflected",
".",
"If",
"the",
"given",
"array",
"contains",
"class",
"names",
"not",
"yet",
"known",
"to",
"this",
"service",
"these",
"classes",
"will",... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1145-L1188 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.isTagIgnored | protected function isTagIgnored($tagName)
{
if (isset($this->settings['ignoredTags'][$tagName]) && $this->settings['ignoredTags'][$tagName] === true) {
return true;
}
// Make this setting backwards compatible with old array schema (deprecated since 3.0)
if (in_array($tagName, $this->settings['ignoredTags'], true)) {
return true;
}
return false;
} | php | protected function isTagIgnored($tagName)
{
if (isset($this->settings['ignoredTags'][$tagName]) && $this->settings['ignoredTags'][$tagName] === true) {
return true;
}
// Make this setting backwards compatible with old array schema (deprecated since 3.0)
if (in_array($tagName, $this->settings['ignoredTags'], true)) {
return true;
}
return false;
} | [
"protected",
"function",
"isTagIgnored",
"(",
"$",
"tagName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"settings",
"[",
"'ignoredTags'",
"]",
"[",
"$",
"tagName",
"]",
")",
"&&",
"$",
"this",
"->",
"settings",
"[",
"'ignoredTags'",
"]",
"[... | Check if a specific annotation tag is configured to be ignored.
@param string $tagName The annotation tag to check
@return boolean true if the tag is configured to be ignored, false otherwise | [
"Check",
"if",
"a",
"specific",
"annotation",
"tag",
"is",
"configured",
"to",
"be",
"ignored",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1196-L1207 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.reflectClass | protected function reflectClass($className)
{
$this->log(sprintf('Reflecting class %s', $className), LogLevel::DEBUG);
$className = $this->cleanClassName($className);
if (strpos($className, 'Neos\Flow\Persistence\Doctrine\Proxies') === 0 && in_array(\Doctrine\ORM\Proxy\Proxy::class, class_implements($className))) {
// Somebody tried to reflect a doctrine proxy, which will have severe side effects.
// see bug http://forge.typo3.org/issues/29449 for details.
throw new Exception\InvalidClassException('The class with name "' . $className . '" is a Doctrine proxy. It is not supported to reflect doctrine proxy classes.', 1314944681);
}
$class = new ClassReflection($className);
if (!isset($this->classReflectionData[$className])) {
$this->classReflectionData[$className] = [];
}
if ($class->isAbstract() || $class->isInterface()) {
$this->classReflectionData[$className][self::DATA_CLASS_ABSTRACT] = true;
}
if ($class->isFinal()) {
$this->classReflectionData[$className][self::DATA_CLASS_FINAL] = true;
}
/** @var $parentClass ClassReflection */
foreach ($this->getParentClasses($class) as $parentClass) {
$this->addParentClass($className, $parentClass);
}
/** @var $interface ClassReflection */
foreach ($class->getInterfaces() as $interface) {
$this->addImplementedInterface($className, $interface);
}
foreach ($this->annotationReader->getClassAnnotations($class) as $annotation) {
$annotationClassName = get_class($annotation);
$this->annotatedClasses[$annotationClassName][$className] = true;
$this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS][] = $annotation;
}
/** @var $property PropertyReflection */
foreach ($class->getProperties() as $property) {
$this->reflectClassProperty($className, $property);
}
foreach ($class->getMethods() as $method) {
$this->reflectClassMethod($className, $method);
}
// Sort reflection data so that the cache data is deterministic. This is
// important for comparisons when checking if classes have changed in a
// Development context.
ksort($this->classReflectionData);
$this->updatedReflectionData[$className] = true;
} | php | protected function reflectClass($className)
{
$this->log(sprintf('Reflecting class %s', $className), LogLevel::DEBUG);
$className = $this->cleanClassName($className);
if (strpos($className, 'Neos\Flow\Persistence\Doctrine\Proxies') === 0 && in_array(\Doctrine\ORM\Proxy\Proxy::class, class_implements($className))) {
// Somebody tried to reflect a doctrine proxy, which will have severe side effects.
// see bug http://forge.typo3.org/issues/29449 for details.
throw new Exception\InvalidClassException('The class with name "' . $className . '" is a Doctrine proxy. It is not supported to reflect doctrine proxy classes.', 1314944681);
}
$class = new ClassReflection($className);
if (!isset($this->classReflectionData[$className])) {
$this->classReflectionData[$className] = [];
}
if ($class->isAbstract() || $class->isInterface()) {
$this->classReflectionData[$className][self::DATA_CLASS_ABSTRACT] = true;
}
if ($class->isFinal()) {
$this->classReflectionData[$className][self::DATA_CLASS_FINAL] = true;
}
/** @var $parentClass ClassReflection */
foreach ($this->getParentClasses($class) as $parentClass) {
$this->addParentClass($className, $parentClass);
}
/** @var $interface ClassReflection */
foreach ($class->getInterfaces() as $interface) {
$this->addImplementedInterface($className, $interface);
}
foreach ($this->annotationReader->getClassAnnotations($class) as $annotation) {
$annotationClassName = get_class($annotation);
$this->annotatedClasses[$annotationClassName][$className] = true;
$this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS][] = $annotation;
}
/** @var $property PropertyReflection */
foreach ($class->getProperties() as $property) {
$this->reflectClassProperty($className, $property);
}
foreach ($class->getMethods() as $method) {
$this->reflectClassMethod($className, $method);
}
// Sort reflection data so that the cache data is deterministic. This is
// important for comparisons when checking if classes have changed in a
// Development context.
ksort($this->classReflectionData);
$this->updatedReflectionData[$className] = true;
} | [
"protected",
"function",
"reflectClass",
"(",
"$",
"className",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"sprintf",
"(",
"'Reflecting class %s'",
",",
"$",
"className",
")",
",",
"LogLevel",
"::",
"DEBUG",
")",
";",
"$",
"className",
"=",
"$",
"this",
"-... | Reflects the given class and stores the results in this service's properties.
@param string $className Full qualified name of the class to reflect
@return void
@throws Exception\InvalidClassException | [
"Reflects",
"the",
"given",
"class",
"and",
"stores",
"the",
"results",
"in",
"this",
"service",
"s",
"properties",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1216-L1269 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.expandType | protected function expandType(ClassReflection $class, $type)
{
$typeWithoutNull = TypeHandling::stripNullableType($type);
$isNullable = $typeWithoutNull !== $type;
// expand "SomeType<SomeElementType>" to "\SomeTypeNamespace\SomeType<\ElementTypeNamespace\ElementType>"
if (strpos($type, '<') !== false) {
$typeParts = explode('<', $typeWithoutNull);
$type = $typeParts[0];
$elementType = rtrim($typeParts[1], '>');
return $this->expandType($class, $type) . '<' . $this->expandType($class, $elementType) . '>' . ($isNullable ? '|null' : '');
}
// expand SomeElementType[]" to "array<\ElementTypeNamespace\SomeElementType>"
if (substr_compare($typeWithoutNull, '[]', -2, 2) === 0) {
$elementType = substr($typeWithoutNull, 0, -2);
return 'array<' . $this->expandType($class, $elementType) . '>' . ($isNullable ? '|null' : '');
}
// skip simple types and types with fully qualified namespaces
if ($type === 'mixed' || $type[0] === '\\' || TypeHandling::isSimpleType($type)) {
return TypeHandling::normalizeType($type) . ($isNullable ? '|null' : '');
}
// we try to find the class relative to the current namespace...
$possibleFullyQualifiedClassName = sprintf('%s\\%s', $class->getNamespaceName(), $typeWithoutNull);
if (class_exists($possibleFullyQualifiedClassName) || interface_exists($possibleFullyQualifiedClassName)) {
return $possibleFullyQualifiedClassName . ($isNullable ? '|null' : '');
}
// and then we try to find "use" statements for the class.
$className = $class->getName();
if (!isset($this->useStatementsForClassCache[$className])) {
$this->useStatementsForClassCache[$className] = $this->getDoctrinePhpParser()->parseClass($class);
}
$useStatementsForClass = $this->useStatementsForClassCache[$className];
// ... and try to expand them
$typeParts = explode('\\', $typeWithoutNull, 2);
$lowercasedFirstTypePart = strtolower($typeParts[0]);
if (isset($useStatementsForClass[$lowercasedFirstTypePart])) {
$typeParts[0] = $useStatementsForClass[$lowercasedFirstTypePart];
return implode('\\', $typeParts) . ($isNullable ? '|null' : '');
}
return $type;
} | php | protected function expandType(ClassReflection $class, $type)
{
$typeWithoutNull = TypeHandling::stripNullableType($type);
$isNullable = $typeWithoutNull !== $type;
// expand "SomeType<SomeElementType>" to "\SomeTypeNamespace\SomeType<\ElementTypeNamespace\ElementType>"
if (strpos($type, '<') !== false) {
$typeParts = explode('<', $typeWithoutNull);
$type = $typeParts[0];
$elementType = rtrim($typeParts[1], '>');
return $this->expandType($class, $type) . '<' . $this->expandType($class, $elementType) . '>' . ($isNullable ? '|null' : '');
}
// expand SomeElementType[]" to "array<\ElementTypeNamespace\SomeElementType>"
if (substr_compare($typeWithoutNull, '[]', -2, 2) === 0) {
$elementType = substr($typeWithoutNull, 0, -2);
return 'array<' . $this->expandType($class, $elementType) . '>' . ($isNullable ? '|null' : '');
}
// skip simple types and types with fully qualified namespaces
if ($type === 'mixed' || $type[0] === '\\' || TypeHandling::isSimpleType($type)) {
return TypeHandling::normalizeType($type) . ($isNullable ? '|null' : '');
}
// we try to find the class relative to the current namespace...
$possibleFullyQualifiedClassName = sprintf('%s\\%s', $class->getNamespaceName(), $typeWithoutNull);
if (class_exists($possibleFullyQualifiedClassName) || interface_exists($possibleFullyQualifiedClassName)) {
return $possibleFullyQualifiedClassName . ($isNullable ? '|null' : '');
}
// and then we try to find "use" statements for the class.
$className = $class->getName();
if (!isset($this->useStatementsForClassCache[$className])) {
$this->useStatementsForClassCache[$className] = $this->getDoctrinePhpParser()->parseClass($class);
}
$useStatementsForClass = $this->useStatementsForClassCache[$className];
// ... and try to expand them
$typeParts = explode('\\', $typeWithoutNull, 2);
$lowercasedFirstTypePart = strtolower($typeParts[0]);
if (isset($useStatementsForClass[$lowercasedFirstTypePart])) {
$typeParts[0] = $useStatementsForClass[$lowercasedFirstTypePart];
return implode('\\', $typeParts) . ($isNullable ? '|null' : '');
}
return $type;
} | [
"protected",
"function",
"expandType",
"(",
"ClassReflection",
"$",
"class",
",",
"$",
"type",
")",
"{",
"$",
"typeWithoutNull",
"=",
"TypeHandling",
"::",
"stripNullableType",
"(",
"$",
"type",
")",
";",
"$",
"isNullable",
"=",
"$",
"typeWithoutNull",
"!==",
... | Expand shortened class names in "var" and "param" annotations, taking use statements into account.
@param ClassReflection $class
@param string $type the type inside var/param annotation
@return string the possibly expanded type | [
"Expand",
"shortened",
"class",
"names",
"in",
"var",
"and",
"param",
"annotations",
"taking",
"use",
"statements",
"into",
"account",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1443-L1490 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.getParentClasses | protected function getParentClasses(ClassReflection $class, array $parentClasses = [])
{
$parentClass = $class->getParentClass();
if ($parentClass !== false) {
$parentClasses[] = $parentClass;
$parentClasses = $this->getParentClasses($parentClass, $parentClasses);
}
return $parentClasses;
} | php | protected function getParentClasses(ClassReflection $class, array $parentClasses = [])
{
$parentClass = $class->getParentClass();
if ($parentClass !== false) {
$parentClasses[] = $parentClass;
$parentClasses = $this->getParentClasses($parentClass, $parentClasses);
}
return $parentClasses;
} | [
"protected",
"function",
"getParentClasses",
"(",
"ClassReflection",
"$",
"class",
",",
"array",
"$",
"parentClasses",
"=",
"[",
"]",
")",
"{",
"$",
"parentClass",
"=",
"$",
"class",
"->",
"getParentClass",
"(",
")",
";",
"if",
"(",
"$",
"parentClass",
"!=... | Finds all parent classes of the given class
@param ClassReflection $class The class to reflect
@param array $parentClasses Array of parent classes
@return array<ClassReflection> | [
"Finds",
"all",
"parent",
"classes",
"of",
"the",
"given",
"class"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1499-L1508 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.buildClassSchemata | protected function buildClassSchemata(array $classNames)
{
foreach ($classNames as $className) {
$this->classSchemata[$className] = $this->buildClassSchema($className);
}
$this->completeRepositoryAssignments();
$this->ensureAggregateRootInheritanceChainConsistency();
} | php | protected function buildClassSchemata(array $classNames)
{
foreach ($classNames as $className) {
$this->classSchemata[$className] = $this->buildClassSchema($className);
}
$this->completeRepositoryAssignments();
$this->ensureAggregateRootInheritanceChainConsistency();
} | [
"protected",
"function",
"buildClassSchemata",
"(",
"array",
"$",
"classNames",
")",
"{",
"foreach",
"(",
"$",
"classNames",
"as",
"$",
"className",
")",
"{",
"$",
"this",
"->",
"classSchemata",
"[",
"$",
"className",
"]",
"=",
"$",
"this",
"->",
"buildCla... | Builds class schemata from classes annotated as entities or value objects
@param array $classNames
@return void | [
"Builds",
"class",
"schemata",
"from",
"classes",
"annotated",
"as",
"entities",
"or",
"value",
"objects"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1516-L1524 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.buildClassSchema | protected function buildClassSchema($className)
{
$classSchema = new ClassSchema($className);
$this->addPropertiesToClassSchema($classSchema);
if ($this->isClassAnnotatedWith($className, ORM\Embeddable::class)) {
return $classSchema;
}
if ($this->isClassAnnotatedWith($className, Flow\ValueObject::class)) {
$this->checkValueObjectRequirements($className);
$classSchema->setModelType(ClassSchema::MODELTYPE_VALUEOBJECT);
return $classSchema;
}
if ($this->isClassAnnotatedWith($className, Flow\Entity::class) || $this->isClassAnnotatedWith($className, ORM\Entity::class)) {
$classSchema->setModelType(ClassSchema::MODELTYPE_ENTITY);
$classSchema->setLazyLoadableObject($this->isClassAnnotatedWith($className, Flow\Lazy::class));
}
$possibleRepositoryClassName = str_replace('\\Model\\', '\\Repository\\', $className) . 'Repository';
if ($this->isClassReflected($possibleRepositoryClassName) === true) {
$classSchema->setRepositoryClassName($possibleRepositoryClassName);
}
return $classSchema;
} | php | protected function buildClassSchema($className)
{
$classSchema = new ClassSchema($className);
$this->addPropertiesToClassSchema($classSchema);
if ($this->isClassAnnotatedWith($className, ORM\Embeddable::class)) {
return $classSchema;
}
if ($this->isClassAnnotatedWith($className, Flow\ValueObject::class)) {
$this->checkValueObjectRequirements($className);
$classSchema->setModelType(ClassSchema::MODELTYPE_VALUEOBJECT);
return $classSchema;
}
if ($this->isClassAnnotatedWith($className, Flow\Entity::class) || $this->isClassAnnotatedWith($className, ORM\Entity::class)) {
$classSchema->setModelType(ClassSchema::MODELTYPE_ENTITY);
$classSchema->setLazyLoadableObject($this->isClassAnnotatedWith($className, Flow\Lazy::class));
}
$possibleRepositoryClassName = str_replace('\\Model\\', '\\Repository\\', $className) . 'Repository';
if ($this->isClassReflected($possibleRepositoryClassName) === true) {
$classSchema->setRepositoryClassName($possibleRepositoryClassName);
}
return $classSchema;
} | [
"protected",
"function",
"buildClassSchema",
"(",
"$",
"className",
")",
"{",
"$",
"classSchema",
"=",
"new",
"ClassSchema",
"(",
"$",
"className",
")",
";",
"$",
"this",
"->",
"addPropertiesToClassSchema",
"(",
"$",
"classSchema",
")",
";",
"if",
"(",
"$",
... | Builds a class schema for the given class name.
@param string $className
@return ClassSchema | [
"Builds",
"a",
"class",
"schema",
"for",
"the",
"given",
"class",
"name",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1532-L1559 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.addPropertiesToClassSchema | protected function addPropertiesToClassSchema(ClassSchema $classSchema)
{
$className = $classSchema->getClassName();
$skipArtificialIdentity = false;
/* @var $valueObjectAnnotation Flow\ValueObject */
$valueObjectAnnotation = $this->getClassAnnotation($className, Flow\ValueObject::class);
if ($valueObjectAnnotation !== null && $valueObjectAnnotation->embedded === true) {
$skipArtificialIdentity = true;
} elseif ($this->isClassAnnotatedWith($className, ORM\Embeddable::class)) {
$skipArtificialIdentity = true;
}
foreach ($this->getClassPropertyNames($className) as $propertyName) {
$skipArtificialIdentity = $this->evaluateClassPropertyAnnotationsForSchema($classSchema, $propertyName) ? true : $skipArtificialIdentity;
}
if ($skipArtificialIdentity !== true) {
$classSchema->addProperty('Persistence_Object_Identifier', 'string');
}
} | php | protected function addPropertiesToClassSchema(ClassSchema $classSchema)
{
$className = $classSchema->getClassName();
$skipArtificialIdentity = false;
/* @var $valueObjectAnnotation Flow\ValueObject */
$valueObjectAnnotation = $this->getClassAnnotation($className, Flow\ValueObject::class);
if ($valueObjectAnnotation !== null && $valueObjectAnnotation->embedded === true) {
$skipArtificialIdentity = true;
} elseif ($this->isClassAnnotatedWith($className, ORM\Embeddable::class)) {
$skipArtificialIdentity = true;
}
foreach ($this->getClassPropertyNames($className) as $propertyName) {
$skipArtificialIdentity = $this->evaluateClassPropertyAnnotationsForSchema($classSchema, $propertyName) ? true : $skipArtificialIdentity;
}
if ($skipArtificialIdentity !== true) {
$classSchema->addProperty('Persistence_Object_Identifier', 'string');
}
} | [
"protected",
"function",
"addPropertiesToClassSchema",
"(",
"ClassSchema",
"$",
"classSchema",
")",
"{",
"$",
"className",
"=",
"$",
"classSchema",
"->",
"getClassName",
"(",
")",
";",
"$",
"skipArtificialIdentity",
"=",
"false",
";",
"/* @var $valueObjectAnnotation F... | Adds properties of the class at hand to the class schema.
Properties will be added if they have a var annotation && (!transient-annotation && !inject-annotation)
Invalid annotations will cause an exception to be thrown.
@param ClassSchema $classSchema
@return void
@throws Exception\InvalidPropertyTypeException | [
"Adds",
"properties",
"of",
"the",
"class",
"at",
"hand",
"to",
"the",
"class",
"schema",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1572-L1592 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.completeRepositoryAssignments | protected function completeRepositoryAssignments()
{
foreach ($this->getAllImplementationClassNamesForInterface(RepositoryInterface::class) as $repositoryClassName) {
// need to be extra careful because this code could be called
// during a cache:flush run with corrupted reflection cache
if (!class_exists($repositoryClassName) || $this->isClassAbstract($repositoryClassName)) {
continue;
}
if (!$this->isClassAnnotatedWith($repositoryClassName, Flow\Scope::class) || $this->getClassAnnotation($repositoryClassName, Flow\Scope::class)->value !== 'singleton') {
throw new ClassSchemaConstraintViolationException('The repository "' . $repositoryClassName . '" must be of scope singleton, but it is not.', 1335790707);
}
if (defined($repositoryClassName . '::ENTITY_CLASSNAME') && isset($this->classSchemata[$repositoryClassName::ENTITY_CLASSNAME])) {
$claimedObjectType = $repositoryClassName::ENTITY_CLASSNAME;
$this->classSchemata[$claimedObjectType]->setRepositoryClassName($repositoryClassName);
}
}
foreach ($this->classSchemata as $classSchema) {
if ($classSchema instanceof ClassSchema && class_exists($classSchema->getClassName()) && $classSchema->isAggregateRoot()) {
$this->makeChildClassesAggregateRoot($classSchema);
}
}
} | php | protected function completeRepositoryAssignments()
{
foreach ($this->getAllImplementationClassNamesForInterface(RepositoryInterface::class) as $repositoryClassName) {
// need to be extra careful because this code could be called
// during a cache:flush run with corrupted reflection cache
if (!class_exists($repositoryClassName) || $this->isClassAbstract($repositoryClassName)) {
continue;
}
if (!$this->isClassAnnotatedWith($repositoryClassName, Flow\Scope::class) || $this->getClassAnnotation($repositoryClassName, Flow\Scope::class)->value !== 'singleton') {
throw new ClassSchemaConstraintViolationException('The repository "' . $repositoryClassName . '" must be of scope singleton, but it is not.', 1335790707);
}
if (defined($repositoryClassName . '::ENTITY_CLASSNAME') && isset($this->classSchemata[$repositoryClassName::ENTITY_CLASSNAME])) {
$claimedObjectType = $repositoryClassName::ENTITY_CLASSNAME;
$this->classSchemata[$claimedObjectType]->setRepositoryClassName($repositoryClassName);
}
}
foreach ($this->classSchemata as $classSchema) {
if ($classSchema instanceof ClassSchema && class_exists($classSchema->getClassName()) && $classSchema->isAggregateRoot()) {
$this->makeChildClassesAggregateRoot($classSchema);
}
}
} | [
"protected",
"function",
"completeRepositoryAssignments",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getAllImplementationClassNamesForInterface",
"(",
"RepositoryInterface",
"::",
"class",
")",
"as",
"$",
"repositoryClassName",
")",
"{",
"// need to be extra caref... | Complete repository-to-entity assignments.
This method looks for repositories that declare themselves responsible
for a specific model and sets a repository classname on the corresponding
models.
It then walks the inheritance chain for all aggregate roots and checks
the subclasses for their aggregate root status - if no repository is
assigned yet, that will be done.
@return void
@throws Exception\ClassSchemaConstraintViolationException | [
"Complete",
"repository",
"-",
"to",
"-",
"entity",
"assignments",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1661-L1684 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.makeChildClassesAggregateRoot | protected function makeChildClassesAggregateRoot(ClassSchema $classSchema)
{
foreach ($this->getAllSubClassNamesForClass($classSchema->getClassName()) as $childClassName) {
if (!isset($this->classSchemata[$childClassName]) || $this->classSchemata[$childClassName]->isAggregateRoot()) {
continue;
}
$this->classSchemata[$childClassName]->setRepositoryClassName($classSchema->getRepositoryClassName());
$this->makeChildClassesAggregateRoot($this->classSchemata[$childClassName]);
}
} | php | protected function makeChildClassesAggregateRoot(ClassSchema $classSchema)
{
foreach ($this->getAllSubClassNamesForClass($classSchema->getClassName()) as $childClassName) {
if (!isset($this->classSchemata[$childClassName]) || $this->classSchemata[$childClassName]->isAggregateRoot()) {
continue;
}
$this->classSchemata[$childClassName]->setRepositoryClassName($classSchema->getRepositoryClassName());
$this->makeChildClassesAggregateRoot($this->classSchemata[$childClassName]);
}
} | [
"protected",
"function",
"makeChildClassesAggregateRoot",
"(",
"ClassSchema",
"$",
"classSchema",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getAllSubClassNamesForClass",
"(",
"$",
"classSchema",
"->",
"getClassName",
"(",
")",
")",
"as",
"$",
"childClassName",
... | Assigns the repository of any aggregate root to all it's
subclasses, unless they are aggregate root already.
@param ClassSchema $classSchema
@return void | [
"Assigns",
"the",
"repository",
"of",
"any",
"aggregate",
"root",
"to",
"all",
"it",
"s",
"subclasses",
"unless",
"they",
"are",
"aggregate",
"root",
"already",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1693-L1703 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.ensureAggregateRootInheritanceChainConsistency | protected function ensureAggregateRootInheritanceChainConsistency()
{
foreach ($this->classSchemata as $className => $classSchema) {
if (!class_exists($className) || ($classSchema instanceof ClassSchema && $classSchema->isAggregateRoot() === false)) {
continue;
}
foreach (class_parents($className) as $parentClassName) {
if (!isset($this->classSchemata[$parentClassName])) {
continue;
}
if ($this->isClassAbstract($parentClassName) === false && $this->classSchemata[$parentClassName]->isAggregateRoot() === false) {
throw new Exception(sprintf('In a class hierarchy of entities either all or no classes must be an aggregate root, "%1$s" is one but the parent class "%2$s" is not. You probably want to add a repository for "%2$s" or remove the Entity annotation.', $className, $parentClassName), 1316009511);
}
}
}
} | php | protected function ensureAggregateRootInheritanceChainConsistency()
{
foreach ($this->classSchemata as $className => $classSchema) {
if (!class_exists($className) || ($classSchema instanceof ClassSchema && $classSchema->isAggregateRoot() === false)) {
continue;
}
foreach (class_parents($className) as $parentClassName) {
if (!isset($this->classSchemata[$parentClassName])) {
continue;
}
if ($this->isClassAbstract($parentClassName) === false && $this->classSchemata[$parentClassName]->isAggregateRoot() === false) {
throw new Exception(sprintf('In a class hierarchy of entities either all or no classes must be an aggregate root, "%1$s" is one but the parent class "%2$s" is not. You probably want to add a repository for "%2$s" or remove the Entity annotation.', $className, $parentClassName), 1316009511);
}
}
}
} | [
"protected",
"function",
"ensureAggregateRootInheritanceChainConsistency",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"classSchemata",
"as",
"$",
"className",
"=>",
"$",
"classSchema",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"className",
")",
... | Checks whether all aggregate roots having superclasses
have a repository assigned up to the tip of their hierarchy.
@return void
@throws Exception | [
"Checks",
"whether",
"all",
"aggregate",
"roots",
"having",
"superclasses",
"have",
"a",
"repository",
"assigned",
"up",
"to",
"the",
"tip",
"of",
"their",
"hierarchy",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1712-L1728 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.checkValueObjectRequirements | protected function checkValueObjectRequirements($className)
{
$methods = get_class_methods($className);
if (in_array('__construct', $methods, true) === false) {
throw new InvalidValueObjectException('A value object must have a constructor, "' . $className . '" does not have one.', 1268740874);
}
$setterMethods = array_filter($methods, function ($method) {
return strpos($method, 'set') === 0;
});
if ($setterMethods !== []) {
throw new InvalidValueObjectException('A value object must not have setters, "' . $className . '" does.', 1268740878);
}
} | php | protected function checkValueObjectRequirements($className)
{
$methods = get_class_methods($className);
if (in_array('__construct', $methods, true) === false) {
throw new InvalidValueObjectException('A value object must have a constructor, "' . $className . '" does not have one.', 1268740874);
}
$setterMethods = array_filter($methods, function ($method) {
return strpos($method, 'set') === 0;
});
if ($setterMethods !== []) {
throw new InvalidValueObjectException('A value object must not have setters, "' . $className . '" does.', 1268740878);
}
} | [
"protected",
"function",
"checkValueObjectRequirements",
"(",
"$",
"className",
")",
"{",
"$",
"methods",
"=",
"get_class_methods",
"(",
"$",
"className",
")",
";",
"if",
"(",
"in_array",
"(",
"'__construct'",
",",
"$",
"methods",
",",
"true",
")",
"===",
"f... | Checks if the given class meets the requirements for a value object, i.e.
does have a constructor and does not have any setter methods.
@param string $className
@return void
@throws InvalidValueObjectException | [
"Checks",
"if",
"the",
"given",
"class",
"meets",
"the",
"requirements",
"for",
"a",
"value",
"object",
"i",
".",
"e",
".",
"does",
"have",
"a",
"constructor",
"and",
"does",
"not",
"have",
"any",
"setter",
"methods",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1738-L1752 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.convertParameterDataToArray | protected function convertParameterDataToArray(array $parametersInformation)
{
$parameters = [];
foreach ($parametersInformation as $parameterName => $parameterData) {
$parameters[$parameterName] = [
'position' => $parameterData[self::DATA_PARAMETER_POSITION],
'optional' => isset($parameterData[self::DATA_PARAMETER_OPTIONAL]),
'type' => $parameterData[self::DATA_PARAMETER_TYPE],
'class' => isset($parameterData[self::DATA_PARAMETER_CLASS]) ? $parameterData[self::DATA_PARAMETER_CLASS] : null,
'array' => isset($parameterData[self::DATA_PARAMETER_ARRAY]),
'byReference' => isset($parameterData[self::DATA_PARAMETER_BY_REFERENCE]),
'allowsNull' => isset($parameterData[self::DATA_PARAMETER_ALLOWS_NULL]),
'defaultValue' => isset($parameterData[self::DATA_PARAMETER_DEFAULT_VALUE]) ? $parameterData[self::DATA_PARAMETER_DEFAULT_VALUE] : null,
'scalarDeclaration' => isset($parameterData[self::DATA_PARAMETER_SCALAR_DECLARATION])
];
}
return $parameters;
} | php | protected function convertParameterDataToArray(array $parametersInformation)
{
$parameters = [];
foreach ($parametersInformation as $parameterName => $parameterData) {
$parameters[$parameterName] = [
'position' => $parameterData[self::DATA_PARAMETER_POSITION],
'optional' => isset($parameterData[self::DATA_PARAMETER_OPTIONAL]),
'type' => $parameterData[self::DATA_PARAMETER_TYPE],
'class' => isset($parameterData[self::DATA_PARAMETER_CLASS]) ? $parameterData[self::DATA_PARAMETER_CLASS] : null,
'array' => isset($parameterData[self::DATA_PARAMETER_ARRAY]),
'byReference' => isset($parameterData[self::DATA_PARAMETER_BY_REFERENCE]),
'allowsNull' => isset($parameterData[self::DATA_PARAMETER_ALLOWS_NULL]),
'defaultValue' => isset($parameterData[self::DATA_PARAMETER_DEFAULT_VALUE]) ? $parameterData[self::DATA_PARAMETER_DEFAULT_VALUE] : null,
'scalarDeclaration' => isset($parameterData[self::DATA_PARAMETER_SCALAR_DECLARATION])
];
}
return $parameters;
} | [
"protected",
"function",
"convertParameterDataToArray",
"(",
"array",
"$",
"parametersInformation",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parametersInformation",
"as",
"$",
"parameterName",
"=>",
"$",
"parameterData",
")",
"{",
"... | Converts the internal, optimized data structure of parameter information into
a human-friendly array with speaking indexes.
@param array $parametersInformation Raw, internal parameter information
@return array Developer friendly version | [
"Converts",
"the",
"internal",
"optimized",
"data",
"structure",
"of",
"parameter",
"information",
"into",
"a",
"human",
"-",
"friendly",
"array",
"with",
"speaking",
"indexes",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1761-L1779 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.convertParameterReflectionToArray | protected function convertParameterReflectionToArray(ParameterReflection $parameter, MethodReflection $method = null)
{
$parameterInformation = [
self::DATA_PARAMETER_POSITION => $parameter->getPosition()
];
if ($parameter->isPassedByReference()) {
$parameterInformation[self::DATA_PARAMETER_BY_REFERENCE] = true;
}
if ($parameter->isArray()) {
$parameterInformation[self::DATA_PARAMETER_ARRAY] = true;
}
if ($parameter->isOptional()) {
$parameterInformation[self::DATA_PARAMETER_OPTIONAL] = true;
}
if ($parameter->allowsNull()) {
$parameterInformation[self::DATA_PARAMETER_ALLOWS_NULL] = true;
}
$parameterClass = $parameter->getClass();
if ($parameterClass !== null) {
$parameterInformation[self::DATA_PARAMETER_CLASS] = $parameterClass->getName();
}
if ($parameter->isOptional() && $parameter->isDefaultValueAvailable()) {
$parameterInformation[self::DATA_PARAMETER_DEFAULT_VALUE] = $parameter->getDefaultValue();
}
if ($method !== null) {
$paramAnnotations = $method->isTaggedWith('param') ? $method->getTagValues('param') : [];
if (isset($paramAnnotations[$parameter->getPosition()])) {
$explodedParameters = explode(' ', $paramAnnotations[$parameter->getPosition()]);
if (count($explodedParameters) >= 2) {
$parameterType = $this->expandType($method->getDeclaringClass(), $explodedParameters[0]);
$parameterInformation[self::DATA_PARAMETER_TYPE] = $this->cleanClassName($parameterType);
}
}
if (!$parameter->isArray()) {
$builtinType = $parameter->getBuiltinType();
if ($builtinType !== null) {
$parameterInformation[self::DATA_PARAMETER_TYPE] = $builtinType;
$parameterInformation[self::DATA_PARAMETER_SCALAR_DECLARATION] = true;
}
}
}
if (!isset($parameterInformation[self::DATA_PARAMETER_TYPE]) && $parameterClass !== null) {
$parameterInformation[self::DATA_PARAMETER_TYPE] = $this->cleanClassName($parameterClass->getName());
} elseif (!isset($parameterInformation[self::DATA_PARAMETER_TYPE])) {
$parameterInformation[self::DATA_PARAMETER_TYPE] = $parameter->isArray() ? 'array' : 'mixed';
}
return $parameterInformation;
} | php | protected function convertParameterReflectionToArray(ParameterReflection $parameter, MethodReflection $method = null)
{
$parameterInformation = [
self::DATA_PARAMETER_POSITION => $parameter->getPosition()
];
if ($parameter->isPassedByReference()) {
$parameterInformation[self::DATA_PARAMETER_BY_REFERENCE] = true;
}
if ($parameter->isArray()) {
$parameterInformation[self::DATA_PARAMETER_ARRAY] = true;
}
if ($parameter->isOptional()) {
$parameterInformation[self::DATA_PARAMETER_OPTIONAL] = true;
}
if ($parameter->allowsNull()) {
$parameterInformation[self::DATA_PARAMETER_ALLOWS_NULL] = true;
}
$parameterClass = $parameter->getClass();
if ($parameterClass !== null) {
$parameterInformation[self::DATA_PARAMETER_CLASS] = $parameterClass->getName();
}
if ($parameter->isOptional() && $parameter->isDefaultValueAvailable()) {
$parameterInformation[self::DATA_PARAMETER_DEFAULT_VALUE] = $parameter->getDefaultValue();
}
if ($method !== null) {
$paramAnnotations = $method->isTaggedWith('param') ? $method->getTagValues('param') : [];
if (isset($paramAnnotations[$parameter->getPosition()])) {
$explodedParameters = explode(' ', $paramAnnotations[$parameter->getPosition()]);
if (count($explodedParameters) >= 2) {
$parameterType = $this->expandType($method->getDeclaringClass(), $explodedParameters[0]);
$parameterInformation[self::DATA_PARAMETER_TYPE] = $this->cleanClassName($parameterType);
}
}
if (!$parameter->isArray()) {
$builtinType = $parameter->getBuiltinType();
if ($builtinType !== null) {
$parameterInformation[self::DATA_PARAMETER_TYPE] = $builtinType;
$parameterInformation[self::DATA_PARAMETER_SCALAR_DECLARATION] = true;
}
}
}
if (!isset($parameterInformation[self::DATA_PARAMETER_TYPE]) && $parameterClass !== null) {
$parameterInformation[self::DATA_PARAMETER_TYPE] = $this->cleanClassName($parameterClass->getName());
} elseif (!isset($parameterInformation[self::DATA_PARAMETER_TYPE])) {
$parameterInformation[self::DATA_PARAMETER_TYPE] = $parameter->isArray() ? 'array' : 'mixed';
}
return $parameterInformation;
} | [
"protected",
"function",
"convertParameterReflectionToArray",
"(",
"ParameterReflection",
"$",
"parameter",
",",
"MethodReflection",
"$",
"method",
"=",
"null",
")",
"{",
"$",
"parameterInformation",
"=",
"[",
"self",
"::",
"DATA_PARAMETER_POSITION",
"=>",
"$",
"param... | Converts the given parameter reflection into an information array
@param ParameterReflection $parameter The parameter to reflect
@param MethodReflection $method The parameter's method
@return array Parameter information array | [
"Converts",
"the",
"given",
"parameter",
"reflection",
"into",
"an",
"information",
"array"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1788-L1837 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.forgetChangedClasses | protected function forgetChangedClasses()
{
$frozenNamespaces = [];
/** @var $package Package */
foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$frozenNamespaces = array_merge($frozenNamespaces, $package->getNamespaces());
}
}
$frozenNamespaces = array_unique($frozenNamespaces);
$classNames = array_keys($this->classReflectionData);
foreach ($frozenNamespaces as $namespace) {
$namespace .= '\\';
foreach ($classNames as $index => $className) {
if (strpos($className, $namespace) === 0) {
unset($classNames[$index]);
}
}
}
foreach ($classNames as $className) {
if (!$this->statusCache->has($this->produceCacheIdentifierFromClassName($className))) {
$this->forgetClass($className);
}
}
} | php | protected function forgetChangedClasses()
{
$frozenNamespaces = [];
/** @var $package Package */
foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$frozenNamespaces = array_merge($frozenNamespaces, $package->getNamespaces());
}
}
$frozenNamespaces = array_unique($frozenNamespaces);
$classNames = array_keys($this->classReflectionData);
foreach ($frozenNamespaces as $namespace) {
$namespace .= '\\';
foreach ($classNames as $index => $className) {
if (strpos($className, $namespace) === 0) {
unset($classNames[$index]);
}
}
}
foreach ($classNames as $className) {
if (!$this->statusCache->has($this->produceCacheIdentifierFromClassName($className))) {
$this->forgetClass($className);
}
}
} | [
"protected",
"function",
"forgetChangedClasses",
"(",
")",
"{",
"$",
"frozenNamespaces",
"=",
"[",
"]",
";",
"/** @var $package Package */",
"foreach",
"(",
"$",
"this",
"->",
"packageManager",
"->",
"getAvailablePackages",
"(",
")",
"as",
"$",
"packageKey",
"=>",... | Checks which classes lack a cache entry and removes their reflection data
accordingly.
@return void | [
"Checks",
"which",
"classes",
"lack",
"a",
"cache",
"entry",
"and",
"removes",
"their",
"reflection",
"data",
"accordingly",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1845-L1871 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.forgetClass | protected function forgetClass($className)
{
$this->log('Forget class ' . $className, LogLevel::DEBUG);
if (isset($this->classesCurrentlyBeingForgotten[$className])) {
$this->log('Detected recursion while forgetting class ' . $className, LogLevel::WARNING);
return;
}
$this->classesCurrentlyBeingForgotten[$className] = true;
if (class_exists($className)) {
$interfaceNames = class_implements($className);
foreach ($interfaceNames as $interfaceName) {
if (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className])) {
unset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className]);
}
}
} else {
foreach ($this->availableClassNames as $interfaceNames) {
foreach ($interfaceNames as $interfaceName) {
if (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className])) {
unset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className]);
}
}
}
}
if (isset($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES])) {
foreach (array_keys($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES]) as $subClassName) {
$this->forgetClass($subClassName);
}
}
foreach (array_keys($this->annotatedClasses) as $annotationClassName) {
if (isset($this->annotatedClasses[$annotationClassName][$className])) {
unset($this->annotatedClasses[$annotationClassName][$className]);
}
}
if (isset($this->classSchemata[$className])) {
unset($this->classSchemata[$className]);
}
foreach (array_keys($this->classesByMethodAnnotations) as $annotationClassName) {
unset($this->classesByMethodAnnotations[$annotationClassName][$className]);
}
unset($this->classReflectionData[$className]);
unset($this->classesCurrentlyBeingForgotten[$className]);
} | php | protected function forgetClass($className)
{
$this->log('Forget class ' . $className, LogLevel::DEBUG);
if (isset($this->classesCurrentlyBeingForgotten[$className])) {
$this->log('Detected recursion while forgetting class ' . $className, LogLevel::WARNING);
return;
}
$this->classesCurrentlyBeingForgotten[$className] = true;
if (class_exists($className)) {
$interfaceNames = class_implements($className);
foreach ($interfaceNames as $interfaceName) {
if (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className])) {
unset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className]);
}
}
} else {
foreach ($this->availableClassNames as $interfaceNames) {
foreach ($interfaceNames as $interfaceName) {
if (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className])) {
unset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className]);
}
}
}
}
if (isset($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES])) {
foreach (array_keys($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES]) as $subClassName) {
$this->forgetClass($subClassName);
}
}
foreach (array_keys($this->annotatedClasses) as $annotationClassName) {
if (isset($this->annotatedClasses[$annotationClassName][$className])) {
unset($this->annotatedClasses[$annotationClassName][$className]);
}
}
if (isset($this->classSchemata[$className])) {
unset($this->classSchemata[$className]);
}
foreach (array_keys($this->classesByMethodAnnotations) as $annotationClassName) {
unset($this->classesByMethodAnnotations[$annotationClassName][$className]);
}
unset($this->classReflectionData[$className]);
unset($this->classesCurrentlyBeingForgotten[$className]);
} | [
"protected",
"function",
"forgetClass",
"(",
"$",
"className",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Forget class '",
".",
"$",
"className",
",",
"LogLevel",
"::",
"DEBUG",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"classesCurrentlyBeingFo... | Forgets all reflection data related to the specified class
@param string $className Name of the class to forget
@return void | [
"Forgets",
"all",
"reflection",
"data",
"related",
"to",
"the",
"specified",
"class"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1879-L1927 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.loadClassReflectionCompiletimeCache | protected function loadClassReflectionCompiletimeCache()
{
$data = $this->reflectionDataCompiletimeCache->get('ReflectionData');
if ($data !== false) {
foreach ($data as $propertyName => $propertyValue) {
$this->$propertyName = $propertyValue;
}
return true;
}
if (!$this->context->isDevelopment()) {
return false;
}
$useIgBinary = extension_loaded('igbinary');
foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) {
if (!$this->packageManager->isPackageFrozen($packageKey)) {
continue;
}
$pathAndFilename = $this->getPrecompiledReflectionStoragePath() . $packageKey . '.dat';
if (!file_exists($pathAndFilename)) {
continue;
}
$data = ($useIgBinary ? igbinary_unserialize(file_get_contents($pathAndFilename)) : unserialize(file_get_contents($pathAndFilename)));
foreach ($data as $propertyName => $propertyValue) {
$this->$propertyName = Arrays::arrayMergeRecursiveOverrule($this->$propertyName, $propertyValue);
}
}
return false;
} | php | protected function loadClassReflectionCompiletimeCache()
{
$data = $this->reflectionDataCompiletimeCache->get('ReflectionData');
if ($data !== false) {
foreach ($data as $propertyName => $propertyValue) {
$this->$propertyName = $propertyValue;
}
return true;
}
if (!$this->context->isDevelopment()) {
return false;
}
$useIgBinary = extension_loaded('igbinary');
foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) {
if (!$this->packageManager->isPackageFrozen($packageKey)) {
continue;
}
$pathAndFilename = $this->getPrecompiledReflectionStoragePath() . $packageKey . '.dat';
if (!file_exists($pathAndFilename)) {
continue;
}
$data = ($useIgBinary ? igbinary_unserialize(file_get_contents($pathAndFilename)) : unserialize(file_get_contents($pathAndFilename)));
foreach ($data as $propertyName => $propertyValue) {
$this->$propertyName = Arrays::arrayMergeRecursiveOverrule($this->$propertyName, $propertyValue);
}
}
return false;
} | [
"protected",
"function",
"loadClassReflectionCompiletimeCache",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"reflectionDataCompiletimeCache",
"->",
"get",
"(",
"'ReflectionData'",
")",
";",
"if",
"(",
"$",
"data",
"!==",
"false",
")",
"{",
"foreach",
"... | Tries to load the reflection data from the compile time cache.
The compile time cache is only supported for Development context and thus
this function will return in any other context.
If no reflection data was found, this method will at least load the precompiled
reflection data of any possible frozen package. Even if precompiled reflection
data could be loaded, false will be returned in order to signal that other
packages still need to be reflected.
@return boolean true if reflection data could be loaded, otherwise false | [
"Tries",
"to",
"load",
"the",
"reflection",
"data",
"from",
"the",
"compile",
"time",
"cache",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1942-L1976 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.loadOrReflectClassIfNecessary | protected function loadOrReflectClassIfNecessary($className)
{
if (!isset($this->classReflectionData[$className]) || is_array($this->classReflectionData[$className])) {
return;
}
if ($this->loadFromClassSchemaRuntimeCache === true) {
$this->classReflectionData[$className] = $this->reflectionDataRuntimeCache->get($this->produceCacheIdentifierFromClassName($className));
return;
}
$this->reflectClass($className);
} | php | protected function loadOrReflectClassIfNecessary($className)
{
if (!isset($this->classReflectionData[$className]) || is_array($this->classReflectionData[$className])) {
return;
}
if ($this->loadFromClassSchemaRuntimeCache === true) {
$this->classReflectionData[$className] = $this->reflectionDataRuntimeCache->get($this->produceCacheIdentifierFromClassName($className));
return;
}
$this->reflectClass($className);
} | [
"protected",
"function",
"loadOrReflectClassIfNecessary",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"classReflectionData",
"[",
"$",
"className",
"]",
")",
"||",
"is_array",
"(",
"$",
"this",
"->",
"classReflectionData",... | Loads reflection data from the cache or reflects the class if needed.
If the class is completely unknown, this method won't try to load or reflect
it. If it is known and reflection data has been loaded already, it won't be
loaded again.
In Production context, with frozen caches, this method will load reflection
data for the specified class from the runtime cache.
@param string $className Name of the class to load data for
@return void | [
"Loads",
"reflection",
"data",
"from",
"the",
"cache",
"or",
"reflects",
"the",
"class",
"if",
"needed",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L1991-L2004 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.freezePackageReflection | public function freezePackageReflection($packageKey)
{
if (!$this->initialized) {
$this->initialize();
}
if (empty($this->availableClassNames)) {
$this->availableClassNames = $this->reflectionDataRuntimeCache->get('__availableClassNames');
}
$reflectionData = [
'classReflectionData' => $this->classReflectionData,
'classSchemata' => $this->classSchemata,
'annotatedClasses' => $this->annotatedClasses,
'classesByMethodAnnotations' => $this->classesByMethodAnnotations
];
$reflectionData['classReflectionData'] = $this->filterArrayByClassesInPackageNamespace($reflectionData['classReflectionData'], $packageKey);
$reflectionData['classSchemata'] = $this->filterArrayByClassesInPackageNamespace($reflectionData['classSchemata'], $packageKey);
$reflectionData['annotatedClasses'] = $this->filterArrayByClassesInPackageNamespace($reflectionData['annotatedClasses'], $packageKey);
$reflectionData['classesByMethodAnnotations'] = isset($reflectionData['classesByMethodAnnotations']) ? $reflectionData['classesByMethodAnnotations'] : [];
$methodAnnotationsFilters = function ($className) use ($packageKey) {
return (isset($this->availableClassNames[$packageKey]) && in_array($className, $this->availableClassNames[$packageKey]));
};
foreach ($reflectionData['classesByMethodAnnotations'] as $annotationClassName => $classNames) {
$reflectionData['classesByMethodAnnotations'][$annotationClassName] = array_filter($classNames, $methodAnnotationsFilters);
}
$precompiledReflectionStoragePath = $this->getPrecompiledReflectionStoragePath();
if (!is_dir($precompiledReflectionStoragePath)) {
Files::createDirectoryRecursively($precompiledReflectionStoragePath);
}
$pathAndFilename = $precompiledReflectionStoragePath . $packageKey . '.dat';
file_put_contents($pathAndFilename, extension_loaded('igbinary') ? igbinary_serialize($reflectionData) : serialize($reflectionData));
} | php | public function freezePackageReflection($packageKey)
{
if (!$this->initialized) {
$this->initialize();
}
if (empty($this->availableClassNames)) {
$this->availableClassNames = $this->reflectionDataRuntimeCache->get('__availableClassNames');
}
$reflectionData = [
'classReflectionData' => $this->classReflectionData,
'classSchemata' => $this->classSchemata,
'annotatedClasses' => $this->annotatedClasses,
'classesByMethodAnnotations' => $this->classesByMethodAnnotations
];
$reflectionData['classReflectionData'] = $this->filterArrayByClassesInPackageNamespace($reflectionData['classReflectionData'], $packageKey);
$reflectionData['classSchemata'] = $this->filterArrayByClassesInPackageNamespace($reflectionData['classSchemata'], $packageKey);
$reflectionData['annotatedClasses'] = $this->filterArrayByClassesInPackageNamespace($reflectionData['annotatedClasses'], $packageKey);
$reflectionData['classesByMethodAnnotations'] = isset($reflectionData['classesByMethodAnnotations']) ? $reflectionData['classesByMethodAnnotations'] : [];
$methodAnnotationsFilters = function ($className) use ($packageKey) {
return (isset($this->availableClassNames[$packageKey]) && in_array($className, $this->availableClassNames[$packageKey]));
};
foreach ($reflectionData['classesByMethodAnnotations'] as $annotationClassName => $classNames) {
$reflectionData['classesByMethodAnnotations'][$annotationClassName] = array_filter($classNames, $methodAnnotationsFilters);
}
$precompiledReflectionStoragePath = $this->getPrecompiledReflectionStoragePath();
if (!is_dir($precompiledReflectionStoragePath)) {
Files::createDirectoryRecursively($precompiledReflectionStoragePath);
}
$pathAndFilename = $precompiledReflectionStoragePath . $packageKey . '.dat';
file_put_contents($pathAndFilename, extension_loaded('igbinary') ? igbinary_serialize($reflectionData) : serialize($reflectionData));
} | [
"public",
"function",
"freezePackageReflection",
"(",
"$",
"packageKey",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"availableCl... | Stores the current reflection data related to classes of the specified package
in the PrecompiledReflectionData directory for the current context.
This method is used by the package manager.
@param string $packageKey
@return void | [
"Stores",
"the",
"current",
"reflection",
"data",
"related",
"to",
"classes",
"of",
"the",
"specified",
"package",
"in",
"the",
"PrecompiledReflectionData",
"directory",
"for",
"the",
"current",
"context",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L2015-L2050 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.filterArrayByClassesInPackageNamespace | protected function filterArrayByClassesInPackageNamespace(array $array, $packageKey)
{
return array_filter($array, function ($className) use ($packageKey) {
return (isset($this->availableClassNames[$packageKey]) && in_array($className, $this->availableClassNames[$packageKey]));
}, ARRAY_FILTER_USE_KEY);
} | php | protected function filterArrayByClassesInPackageNamespace(array $array, $packageKey)
{
return array_filter($array, function ($className) use ($packageKey) {
return (isset($this->availableClassNames[$packageKey]) && in_array($className, $this->availableClassNames[$packageKey]));
}, ARRAY_FILTER_USE_KEY);
} | [
"protected",
"function",
"filterArrayByClassesInPackageNamespace",
"(",
"array",
"$",
"array",
",",
"$",
"packageKey",
")",
"{",
"return",
"array_filter",
"(",
"$",
"array",
",",
"function",
"(",
"$",
"className",
")",
"use",
"(",
"$",
"packageKey",
")",
"{",
... | Filter an array of entries were keys are class names by being in the given package namespace.
@param array $array
@param string $packageKey
@return array | [
"Filter",
"an",
"array",
"of",
"entries",
"were",
"keys",
"are",
"class",
"names",
"by",
"being",
"in",
"the",
"given",
"package",
"namespace",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L2059-L2064 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.unfreezePackageReflection | public function unfreezePackageReflection($packageKey)
{
if (!$this->initialized) {
$this->initialize();
}
$pathAndFilename = $this->getPrecompiledReflectionStoragePath() . $packageKey . '.dat';
if (file_exists($pathAndFilename)) {
unlink($pathAndFilename);
}
} | php | public function unfreezePackageReflection($packageKey)
{
if (!$this->initialized) {
$this->initialize();
}
$pathAndFilename = $this->getPrecompiledReflectionStoragePath() . $packageKey . '.dat';
if (file_exists($pathAndFilename)) {
unlink($pathAndFilename);
}
} | [
"public",
"function",
"unfreezePackageReflection",
"(",
"$",
"packageKey",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"}",
"$",
"pathAndFilename",
"=",
"$",
"this",
"->",
"getPrec... | Removes the precompiled reflection data of a frozen package
This method is used by the package manager.
@param string $packageKey The package to remove the data from
@return void | [
"Removes",
"the",
"precompiled",
"reflection",
"data",
"of",
"a",
"frozen",
"package"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L2074-L2083 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.saveToCache | public function saveToCache()
{
if ($this->hasFrozenCacheInProduction()) {
return;
}
if (!$this->initialized) {
$this->initialize();
}
if ($this->loadFromClassSchemaRuntimeCache === true) {
return;
}
if (!($this->reflectionDataCompiletimeCache instanceof FrontendInterface)) {
throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
}
if (!empty($this->availableClassNames)) {
$this->reflectionDataRuntimeCache->set('__availableClassNames', $this->availableClassNames);
}
if ($this->updatedReflectionData !== []) {
$this->updateReflectionData();
}
if ($this->context->isProduction()) {
$this->saveProductionData();
return;
}
$this->saveDevelopmentData();
} | php | public function saveToCache()
{
if ($this->hasFrozenCacheInProduction()) {
return;
}
if (!$this->initialized) {
$this->initialize();
}
if ($this->loadFromClassSchemaRuntimeCache === true) {
return;
}
if (!($this->reflectionDataCompiletimeCache instanceof FrontendInterface)) {
throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
}
if (!empty($this->availableClassNames)) {
$this->reflectionDataRuntimeCache->set('__availableClassNames', $this->availableClassNames);
}
if ($this->updatedReflectionData !== []) {
$this->updateReflectionData();
}
if ($this->context->isProduction()) {
$this->saveProductionData();
return;
}
$this->saveDevelopmentData();
} | [
"public",
"function",
"saveToCache",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasFrozenCacheInProduction",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
... | Exports the internal reflection data into the ReflectionData cache
This method is triggered by a signal which is connected to the bootstrap's
shutdown sequence.
If the reflection data has previously been loaded from the runtime cache,
saving it is omitted as changes are not expected.
In Production context the whole cache is written at once and then frozen in
order to be consistent. Frozen cache data in Development is only produced for
classes contained in frozen packages.
@return void
@throws Exception if no cache has been injected | [
"Exports",
"the",
"internal",
"reflection",
"data",
"into",
"the",
"ReflectionData",
"cache"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L2101-L2131 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.saveDevelopmentData | protected function saveDevelopmentData()
{
foreach (array_keys($this->packageManager->getFrozenPackages()) as $packageKey) {
$pathAndFilename = $this->getPrecompiledReflectionStoragePath() . $packageKey . '.dat';
if (!file_exists($pathAndFilename)) {
$this->log(sprintf('Rebuilding precompiled reflection data for frozen package %s.', $packageKey), LogLevel::DEBUG);
$this->freezePackageReflection($packageKey);
}
}
} | php | protected function saveDevelopmentData()
{
foreach (array_keys($this->packageManager->getFrozenPackages()) as $packageKey) {
$pathAndFilename = $this->getPrecompiledReflectionStoragePath() . $packageKey . '.dat';
if (!file_exists($pathAndFilename)) {
$this->log(sprintf('Rebuilding precompiled reflection data for frozen package %s.', $packageKey), LogLevel::DEBUG);
$this->freezePackageReflection($packageKey);
}
}
} | [
"protected",
"function",
"saveDevelopmentData",
"(",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"packageManager",
"->",
"getFrozenPackages",
"(",
")",
")",
"as",
"$",
"packageKey",
")",
"{",
"$",
"pathAndFilename",
"=",
"$",
"this",
"->"... | Save reflection data to cache in Development context. | [
"Save",
"reflection",
"data",
"to",
"cache",
"in",
"Development",
"context",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L2136-L2145 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.saveProductionData | protected function saveProductionData()
{
$this->reflectionDataRuntimeCache->flush();
$classNames = [];
foreach ($this->classReflectionData as $className => $reflectionData) {
$classNames[$className] = true;
$cacheIdentifier = $this->produceCacheIdentifierFromClassName($className);
$this->reflectionDataRuntimeCache->set($cacheIdentifier, $reflectionData);
if (isset($this->classSchemata[$className])) {
$this->classSchemataRuntimeCache->set($cacheIdentifier, $this->classSchemata[$className]);
}
}
$this->reflectionDataRuntimeCache->set('__classNames', $classNames);
$this->reflectionDataRuntimeCache->set('__annotatedClasses', $this->annotatedClasses);
$this->reflectionDataRuntimeCache->getBackend()->freeze();
$this->classSchemataRuntimeCache->getBackend()->freeze();
$this->log(sprintf('Built and froze reflection runtime caches (%s classes).', count($this->classReflectionData)), LogLevel::INFO);
} | php | protected function saveProductionData()
{
$this->reflectionDataRuntimeCache->flush();
$classNames = [];
foreach ($this->classReflectionData as $className => $reflectionData) {
$classNames[$className] = true;
$cacheIdentifier = $this->produceCacheIdentifierFromClassName($className);
$this->reflectionDataRuntimeCache->set($cacheIdentifier, $reflectionData);
if (isset($this->classSchemata[$className])) {
$this->classSchemataRuntimeCache->set($cacheIdentifier, $this->classSchemata[$className]);
}
}
$this->reflectionDataRuntimeCache->set('__classNames', $classNames);
$this->reflectionDataRuntimeCache->set('__annotatedClasses', $this->annotatedClasses);
$this->reflectionDataRuntimeCache->getBackend()->freeze();
$this->classSchemataRuntimeCache->getBackend()->freeze();
$this->log(sprintf('Built and froze reflection runtime caches (%s classes).', count($this->classReflectionData)), LogLevel::INFO);
} | [
"protected",
"function",
"saveProductionData",
"(",
")",
"{",
"$",
"this",
"->",
"reflectionDataRuntimeCache",
"->",
"flush",
"(",
")",
";",
"$",
"classNames",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"classReflectionData",
"as",
"$",
"classNam... | Save reflection data to cache in Production context. | [
"Save",
"reflection",
"data",
"to",
"cache",
"in",
"Production",
"context",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L2150-L2170 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.updateReflectionData | protected function updateReflectionData()
{
$this->log(sprintf('Found %s classes whose reflection data was not cached previously.', count($this->updatedReflectionData)), LogLevel::DEBUG);
foreach (array_keys($this->updatedReflectionData) as $className) {
$this->statusCache->set($this->produceCacheIdentifierFromClassName($className), '');
}
$data = [];
$propertyNames = [
'classReflectionData',
'classSchemata',
'annotatedClasses',
'classesByMethodAnnotations'
];
foreach ($propertyNames as $propertyName) {
$data[$propertyName] = $this->$propertyName;
}
$this->reflectionDataCompiletimeCache->set('ReflectionData', $data);
} | php | protected function updateReflectionData()
{
$this->log(sprintf('Found %s classes whose reflection data was not cached previously.', count($this->updatedReflectionData)), LogLevel::DEBUG);
foreach (array_keys($this->updatedReflectionData) as $className) {
$this->statusCache->set($this->produceCacheIdentifierFromClassName($className), '');
}
$data = [];
$propertyNames = [
'classReflectionData',
'classSchemata',
'annotatedClasses',
'classesByMethodAnnotations'
];
foreach ($propertyNames as $propertyName) {
$data[$propertyName] = $this->$propertyName;
}
$this->reflectionDataCompiletimeCache->set('ReflectionData', $data);
} | [
"protected",
"function",
"updateReflectionData",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"sprintf",
"(",
"'Found %s classes whose reflection data was not cached previously.'",
",",
"count",
"(",
"$",
"this",
"->",
"updatedReflectionData",
")",
")",
",",
"LogLeve... | Set updated reflection data to caches. | [
"Set",
"updated",
"reflection",
"data",
"to",
"caches",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L2175-L2196 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/ReflectionService.php | ReflectionService.log | protected function log($message, $severity = LogLevel::INFO, $additionalData = [])
{
if (is_object($this->logger)) {
$this->logger->log($severity, $message, $additionalData);
}
} | php | protected function log($message, $severity = LogLevel::INFO, $additionalData = [])
{
if (is_object($this->logger)) {
$this->logger->log($severity, $message, $additionalData);
}
} | [
"protected",
"function",
"log",
"(",
"$",
"message",
",",
"$",
"severity",
"=",
"LogLevel",
"::",
"INFO",
",",
"$",
"additionalData",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"this",
"->",
"logger",
")",
")",
"{",
"$",
"this",
"->... | Writes the given message along with the additional information into the log.
@param string $message The message to log
@param string $severity One of the PSR LogLevel constants
@param array $additionalData An array containing more information about the event to be logged
@return void | [
"Writes",
"the",
"given",
"message",
"along",
"with",
"the",
"additional",
"information",
"into",
"the",
"log",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/ReflectionService.php#L2228-L2233 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.initializeController | protected function initializeController(RequestInterface $request, ResponseInterface $response)
{
if (!$request instanceof ActionRequest) {
throw new UnsupportedRequestTypeException(get_class($this) . ' only supports action requests – requests of type "' . get_class($request) . '" given.', 1187701131);
}
$this->request = $request;
$this->request->setDispatched(true);
$this->response = $response;
$this->uriBuilder = new UriBuilder();
$this->uriBuilder->setRequest($this->request);
$this->arguments = new Arguments([]);
$this->controllerContext = new ControllerContext($this->request, $this->response, $this->arguments, $this->uriBuilder);
$mediaType = MediaTypeHelper::negotiateMediaType(MediaTypeHelper::determineAcceptedMediaTypes($request->getHttpRequest()), $this->supportedMediaTypes);
if ($mediaType === null) {
$this->throwStatus(406);
}
if ($request->getFormat() === null) {
$this->request->setFormat(MediaTypes::getFilenameExtensionFromMediaType($mediaType));
}
} | php | protected function initializeController(RequestInterface $request, ResponseInterface $response)
{
if (!$request instanceof ActionRequest) {
throw new UnsupportedRequestTypeException(get_class($this) . ' only supports action requests – requests of type "' . get_class($request) . '" given.', 1187701131);
}
$this->request = $request;
$this->request->setDispatched(true);
$this->response = $response;
$this->uriBuilder = new UriBuilder();
$this->uriBuilder->setRequest($this->request);
$this->arguments = new Arguments([]);
$this->controllerContext = new ControllerContext($this->request, $this->response, $this->arguments, $this->uriBuilder);
$mediaType = MediaTypeHelper::negotiateMediaType(MediaTypeHelper::determineAcceptedMediaTypes($request->getHttpRequest()), $this->supportedMediaTypes);
if ($mediaType === null) {
$this->throwStatus(406);
}
if ($request->getFormat() === null) {
$this->request->setFormat(MediaTypes::getFilenameExtensionFromMediaType($mediaType));
}
} | [
"protected",
"function",
"initializeController",
"(",
"RequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"ActionRequest",
")",
"{",
"throw",
"new",
"UnsupportedRequestTypeException",
... | Initializes the controller
This method should be called by the concrete processRequest() method.
@param RequestInterface $request
@param ResponseInterface|ActionResponse $response
@throws UnsupportedRequestTypeException
TODO: This should expect an ActionRequest and ActionResponse in the next major. | [
"Initializes",
"the",
"controller"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L111-L134 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.addFlashMessage | public function addFlashMessage($messageBody, $messageTitle = '', $severity = Error\Message::SEVERITY_OK, array $messageArguments = [], $messageCode = null)
{
if (!is_string($messageBody)) {
throw new \InvalidArgumentException('The message body must be of type string, "' . gettype($messageBody) . '" given.', 1243258395);
}
switch ($severity) {
case Error\Message::SEVERITY_NOTICE:
$message = new Error\Notice($messageBody, $messageCode, $messageArguments, $messageTitle);
break;
case Error\Message::SEVERITY_WARNING:
$message = new Error\Warning($messageBody, $messageCode, $messageArguments, $messageTitle);
break;
case Error\Message::SEVERITY_ERROR:
$message = new Error\Error($messageBody, $messageCode, $messageArguments, $messageTitle);
break;
default:
$message = new Error\Message($messageBody, $messageCode, $messageArguments, $messageTitle);
break;
}
$this->flashMessageContainer->addMessage($message);
} | php | public function addFlashMessage($messageBody, $messageTitle = '', $severity = Error\Message::SEVERITY_OK, array $messageArguments = [], $messageCode = null)
{
if (!is_string($messageBody)) {
throw new \InvalidArgumentException('The message body must be of type string, "' . gettype($messageBody) . '" given.', 1243258395);
}
switch ($severity) {
case Error\Message::SEVERITY_NOTICE:
$message = new Error\Notice($messageBody, $messageCode, $messageArguments, $messageTitle);
break;
case Error\Message::SEVERITY_WARNING:
$message = new Error\Warning($messageBody, $messageCode, $messageArguments, $messageTitle);
break;
case Error\Message::SEVERITY_ERROR:
$message = new Error\Error($messageBody, $messageCode, $messageArguments, $messageTitle);
break;
default:
$message = new Error\Message($messageBody, $messageCode, $messageArguments, $messageTitle);
break;
}
$this->flashMessageContainer->addMessage($message);
} | [
"public",
"function",
"addFlashMessage",
"(",
"$",
"messageBody",
",",
"$",
"messageTitle",
"=",
"''",
",",
"$",
"severity",
"=",
"Error",
"\\",
"Message",
"::",
"SEVERITY_OK",
",",
"array",
"$",
"messageArguments",
"=",
"[",
"]",
",",
"$",
"messageCode",
... | Creates a Message object and adds it to the FlashMessageContainer.
This method should be used to add FlashMessages rather than interacting with the container directly.
@param string $messageBody text of the FlashMessage
@param string $messageTitle optional header of the FlashMessage
@param string $severity severity of the FlashMessage (one of the Message::SEVERITY_* constants)
@param array $messageArguments arguments to be passed to the FlashMessage
@param integer $messageCode
@return void
@throws \InvalidArgumentException if the message body is no string
@see Error\Message
@api | [
"Creates",
"a",
"Message",
"object",
"and",
"adds",
"it",
"to",
"the",
"FlashMessageContainer",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L163-L183 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.forward | protected function forward($actionName, $controllerName = null, $packageKey = null, array $arguments = [])
{
$nextRequest = clone $this->request;
$nextRequest->setControllerActionName($actionName);
if ($controllerName !== null) {
$nextRequest->setControllerName($controllerName);
}
if ($packageKey !== null && strpos($packageKey, '\\') !== false) {
list($packageKey, $subpackageKey) = explode('\\', $packageKey, 2);
} else {
$subpackageKey = null;
}
if ($packageKey !== null) {
$nextRequest->setControllerPackageKey($packageKey);
$nextRequest->setControllerSubpackageKey($subpackageKey);
}
$regularArguments = [];
foreach ($arguments as $argumentName => $argumentValue) {
if (substr($argumentName, 0, 2) === '__') {
$nextRequest->setArgument($argumentName, $argumentValue);
} else {
$regularArguments[$argumentName] = $argumentValue;
}
}
$nextRequest->setArguments($this->persistenceManager->convertObjectsToIdentityArrays($regularArguments));
$this->arguments->removeAll();
$forwardException = new ForwardException();
$forwardException->setNextRequest($nextRequest);
throw $forwardException;
} | php | protected function forward($actionName, $controllerName = null, $packageKey = null, array $arguments = [])
{
$nextRequest = clone $this->request;
$nextRequest->setControllerActionName($actionName);
if ($controllerName !== null) {
$nextRequest->setControllerName($controllerName);
}
if ($packageKey !== null && strpos($packageKey, '\\') !== false) {
list($packageKey, $subpackageKey) = explode('\\', $packageKey, 2);
} else {
$subpackageKey = null;
}
if ($packageKey !== null) {
$nextRequest->setControllerPackageKey($packageKey);
$nextRequest->setControllerSubpackageKey($subpackageKey);
}
$regularArguments = [];
foreach ($arguments as $argumentName => $argumentValue) {
if (substr($argumentName, 0, 2) === '__') {
$nextRequest->setArgument($argumentName, $argumentValue);
} else {
$regularArguments[$argumentName] = $argumentValue;
}
}
$nextRequest->setArguments($this->persistenceManager->convertObjectsToIdentityArrays($regularArguments));
$this->arguments->removeAll();
$forwardException = new ForwardException();
$forwardException->setNextRequest($nextRequest);
throw $forwardException;
} | [
"protected",
"function",
"forward",
"(",
"$",
"actionName",
",",
"$",
"controllerName",
"=",
"null",
",",
"$",
"packageKey",
"=",
"null",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"nextRequest",
"=",
"clone",
"$",
"this",
"->",
"req... | Forwards the request to another action and / or controller.
Request is directly transferred to the other action / controller
@param string $actionName Name of the action to forward to
@param string $controllerName Unqualified object name of the controller to forward to. If not specified, the current controller is used.
@param string $packageKey Key of the package containing the controller to forward to. May also contain the sub package, concatenated with backslash (Vendor.Foo\Bar\Baz). If not specified, the current package is assumed.
@param array $arguments Arguments to pass to the target action
@return void
@throws ForwardException
@see redirect()
@api | [
"Forwards",
"the",
"request",
"to",
"another",
"action",
"and",
"/",
"or",
"controller",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L199-L231 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.forwardToRequest | protected function forwardToRequest(ActionRequest $request)
{
$packageKey = $request->getControllerPackageKey();
$subpackageKey = $request->getControllerSubpackageKey();
if ($subpackageKey !== null) {
$packageKey .= '\\' . $subpackageKey;
}
$this->forward($request->getControllerActionName(), $request->getControllerName(), $packageKey, $request->getArguments());
} | php | protected function forwardToRequest(ActionRequest $request)
{
$packageKey = $request->getControllerPackageKey();
$subpackageKey = $request->getControllerSubpackageKey();
if ($subpackageKey !== null) {
$packageKey .= '\\' . $subpackageKey;
}
$this->forward($request->getControllerActionName(), $request->getControllerName(), $packageKey, $request->getArguments());
} | [
"protected",
"function",
"forwardToRequest",
"(",
"ActionRequest",
"$",
"request",
")",
"{",
"$",
"packageKey",
"=",
"$",
"request",
"->",
"getControllerPackageKey",
"(",
")",
";",
"$",
"subpackageKey",
"=",
"$",
"request",
"->",
"getControllerSubpackageKey",
"(",... | Forwards the request to another action and / or controller.
Request is directly transfered to the other action / controller
@param ActionRequest $request The request to redirect to
@return void
@throws ForwardException
@see redirectToRequest()
@api | [
"Forwards",
"the",
"request",
"to",
"another",
"action",
"and",
"/",
"or",
"controller",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L244-L252 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.redirect | protected function redirect($actionName, $controllerName = null, $packageKey = null, array $arguments = null, $delay = 0, $statusCode = 303, $format = null)
{
if ($packageKey !== null && strpos($packageKey, '\\') !== false) {
list($packageKey, $subpackageKey) = explode('\\', $packageKey, 2);
} else {
$subpackageKey = null;
}
$this->uriBuilder->reset();
if ($format === null) {
$this->uriBuilder->setFormat($this->request->getFormat());
} else {
$this->uriBuilder->setFormat($format);
}
$uri = $this->uriBuilder->setCreateAbsoluteUri(true)->uriFor($actionName, $arguments, $controllerName, $packageKey, $subpackageKey);
$this->redirectToUri($uri, $delay, $statusCode);
} | php | protected function redirect($actionName, $controllerName = null, $packageKey = null, array $arguments = null, $delay = 0, $statusCode = 303, $format = null)
{
if ($packageKey !== null && strpos($packageKey, '\\') !== false) {
list($packageKey, $subpackageKey) = explode('\\', $packageKey, 2);
} else {
$subpackageKey = null;
}
$this->uriBuilder->reset();
if ($format === null) {
$this->uriBuilder->setFormat($this->request->getFormat());
} else {
$this->uriBuilder->setFormat($format);
}
$uri = $this->uriBuilder->setCreateAbsoluteUri(true)->uriFor($actionName, $arguments, $controllerName, $packageKey, $subpackageKey);
$this->redirectToUri($uri, $delay, $statusCode);
} | [
"protected",
"function",
"redirect",
"(",
"$",
"actionName",
",",
"$",
"controllerName",
"=",
"null",
",",
"$",
"packageKey",
"=",
"null",
",",
"array",
"$",
"arguments",
"=",
"null",
",",
"$",
"delay",
"=",
"0",
",",
"$",
"statusCode",
"=",
"303",
","... | Redirects the request to another action and / or controller.
Redirect will be sent to the client which then performs another request to the new URI.
NOTE: This method only supports web requests and will throw an exception
if used with other request types.
@param string $actionName Name of the action to forward to
@param string $controllerName Unqualified object name of the controller to forward to. If not specified, the current controller is used.
@param string $packageKey Key of the package containing the controller to forward to. If not specified, the current package is assumed.
@param array $arguments Array of arguments for the target action
@param integer $delay (optional) The delay in seconds. Default is no delay.
@param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other"
@param string $format The format to use for the redirect URI
@return void
@throws StopActionException
@see forward()
@api | [
"Redirects",
"the",
"request",
"to",
"another",
"action",
"and",
"/",
"or",
"controller",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L274-L290 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.redirectToRequest | protected function redirectToRequest(ActionRequest $request, $delay = 0, $statusCode = 303)
{
$packageKey = $request->getControllerPackageKey();
$subpackageKey = $request->getControllerSubpackageKey();
if ($subpackageKey !== null) {
$packageKey .= '\\' . $subpackageKey;
}
$this->redirect($request->getControllerActionName(), $request->getControllerName(), $packageKey, $request->getArguments(), $delay, $statusCode, $request->getFormat());
} | php | protected function redirectToRequest(ActionRequest $request, $delay = 0, $statusCode = 303)
{
$packageKey = $request->getControllerPackageKey();
$subpackageKey = $request->getControllerSubpackageKey();
if ($subpackageKey !== null) {
$packageKey .= '\\' . $subpackageKey;
}
$this->redirect($request->getControllerActionName(), $request->getControllerName(), $packageKey, $request->getArguments(), $delay, $statusCode, $request->getFormat());
} | [
"protected",
"function",
"redirectToRequest",
"(",
"ActionRequest",
"$",
"request",
",",
"$",
"delay",
"=",
"0",
",",
"$",
"statusCode",
"=",
"303",
")",
"{",
"$",
"packageKey",
"=",
"$",
"request",
"->",
"getControllerPackageKey",
"(",
")",
";",
"$",
"sub... | Redirects the request to another action and / or controller.
Redirect will be sent to the client which then performs another request to the new URI.
NOTE: This method only supports web requests and will throw an exception
if used with other request types.
@param ActionRequest $request The request to redirect to
@param integer $delay (optional) The delay in seconds. Default is no delay.
@param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other"
@return void
@throws StopActionException
@see forwardToRequest()
@api | [
"Redirects",
"the",
"request",
"to",
"another",
"action",
"and",
"/",
"or",
"controller",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L308-L316 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.redirectToUri | protected function redirectToUri($uri, $delay = 0, $statusCode = 303)
{
if ($delay === 0) {
if (!$uri instanceof UriInterface) {
$uri = new \Neos\Flow\Http\Uri($uri);
}
$this->response->setStatus($statusCode);
$this->response->setHeader('Location', (string)$uri);
} else {
$escapedUri = htmlentities($uri, ENT_QUOTES, 'utf-8');
$this->response->setStatus($statusCode);
$this->response->setContent('<html><head><meta http-equiv="refresh" content="' . (int)$delay . ';url=' . $escapedUri . '"/></head></html>');
}
throw new StopActionException();
} | php | protected function redirectToUri($uri, $delay = 0, $statusCode = 303)
{
if ($delay === 0) {
if (!$uri instanceof UriInterface) {
$uri = new \Neos\Flow\Http\Uri($uri);
}
$this->response->setStatus($statusCode);
$this->response->setHeader('Location', (string)$uri);
} else {
$escapedUri = htmlentities($uri, ENT_QUOTES, 'utf-8');
$this->response->setStatus($statusCode);
$this->response->setContent('<html><head><meta http-equiv="refresh" content="' . (int)$delay . ';url=' . $escapedUri . '"/></head></html>');
}
throw new StopActionException();
} | [
"protected",
"function",
"redirectToUri",
"(",
"$",
"uri",
",",
"$",
"delay",
"=",
"0",
",",
"$",
"statusCode",
"=",
"303",
")",
"{",
"if",
"(",
"$",
"delay",
"===",
"0",
")",
"{",
"if",
"(",
"!",
"$",
"uri",
"instanceof",
"UriInterface",
")",
"{",... | Redirects to another URI
@param mixed $uri Either a string representation of a URI or a \Neos\Flow\Http\Uri object
@param integer $delay (optional) The delay in seconds. Default is no delay.
@param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other"
@throws UnsupportedRequestTypeException If the request is not a web request
@throws StopActionException
@api | [
"Redirects",
"to",
"another",
"URI"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L328-L342 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.throwStatus | protected function throwStatus($statusCode, $statusMessage = null, $content = null)
{
$this->response->setStatus($statusCode, $statusMessage);
if ($content === null) {
$content = $this->response->getStatus();
}
$this->response->setContent($content);
throw new StopActionException();
} | php | protected function throwStatus($statusCode, $statusMessage = null, $content = null)
{
$this->response->setStatus($statusCode, $statusMessage);
if ($content === null) {
$content = $this->response->getStatus();
}
$this->response->setContent($content);
throw new StopActionException();
} | [
"protected",
"function",
"throwStatus",
"(",
"$",
"statusCode",
",",
"$",
"statusMessage",
"=",
"null",
",",
"$",
"content",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"response",
"->",
"setStatus",
"(",
"$",
"statusCode",
",",
"$",
"statusMessage",
")",
... | Sends the specified HTTP status immediately.
NOTE: This method only supports web requests and will throw an exception if used with other request types.
TODO: statusMessage argument is deprecated and will no longer be used from 6.0
@param integer $statusCode The HTTP status code
@param string $statusMessage A custom HTTP status message
@param string $content Body content which further explains the status
@throws UnsupportedRequestTypeException If the request is not a web request
@throws StopActionException
@api | [
"Sends",
"the",
"specified",
"HTTP",
"status",
"immediately",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L358-L366 |
neos/flow-development-collection | Neos.Flow/Classes/Mvc/Controller/AbstractController.php | AbstractController.mapRequestArgumentsToControllerArguments | protected function mapRequestArgumentsToControllerArguments()
{
foreach ($this->arguments as $argument) {
$argumentName = $argument->getName();
if ($this->request->hasArgument($argumentName)) {
$argument->setValue($this->request->getArgument($argumentName));
} elseif ($argument->isRequired()) {
throw new RequiredArgumentMissingException('Required argument "' . $argumentName . '" is not set.', 1298012500);
}
}
} | php | protected function mapRequestArgumentsToControllerArguments()
{
foreach ($this->arguments as $argument) {
$argumentName = $argument->getName();
if ($this->request->hasArgument($argumentName)) {
$argument->setValue($this->request->getArgument($argumentName));
} elseif ($argument->isRequired()) {
throw new RequiredArgumentMissingException('Required argument "' . $argumentName . '" is not set.', 1298012500);
}
}
} | [
"protected",
"function",
"mapRequestArgumentsToControllerArguments",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"arguments",
"as",
"$",
"argument",
")",
"{",
"$",
"argumentName",
"=",
"$",
"argument",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"$",
... | Maps arguments delivered by the request object to the local controller arguments.
@return void
@throws RequiredArgumentMissingException
@api | [
"Maps",
"arguments",
"delivered",
"by",
"the",
"request",
"object",
"to",
"the",
"local",
"controller",
"arguments",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Mvc/Controller/AbstractController.php#L375-L385 |
neos/flow-development-collection | Neos.Flow/Classes/Reflection/MethodReflection.php | MethodReflection.getParameters | public function getParameters()
{
$extendedParameters = [];
foreach (parent::getParameters() as $parameter) {
$extendedParameters[] = new ParameterReflection([$this->getDeclaringClass()->getName(), $this->getName()], $parameter->getName());
}
return $extendedParameters;
} | php | public function getParameters()
{
$extendedParameters = [];
foreach (parent::getParameters() as $parameter) {
$extendedParameters[] = new ParameterReflection([$this->getDeclaringClass()->getName(), $this->getName()], $parameter->getName());
}
return $extendedParameters;
} | [
"public",
"function",
"getParameters",
"(",
")",
"{",
"$",
"extendedParameters",
"=",
"[",
"]",
";",
"foreach",
"(",
"parent",
"::",
"getParameters",
"(",
")",
"as",
"$",
"parameter",
")",
"{",
"$",
"extendedParameters",
"[",
"]",
"=",
"new",
"ParameterRef... | Replacement for the original getParameters() method which makes sure
that ParameterReflection objects are returned instead of the
original ReflectionParameter instances.
@return array<ParameterReflection> objects of the parameters of this method | [
"Replacement",
"for",
"the",
"original",
"getParameters",
"()",
"method",
"which",
"makes",
"sure",
"that",
"ParameterReflection",
"objects",
"are",
"returned",
"instead",
"of",
"the",
"original",
"ReflectionParameter",
"instances",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Flow/Classes/Reflection/MethodReflection.php#L45-L52 |
neos/flow-development-collection | Neos.Eel/Classes/CompilingEvaluator.php | CompilingEvaluator.evaluate | public function evaluate($expression, Context $context)
{
$expression = trim($expression);
$identifier = md5($expression);
$functionName = 'expression_' . $identifier;
if (isset($this->evaluatedExpressions[$functionName])) {
return $this->evaluateAndUnwrap($this->evaluatedExpressions[$functionName], $context);
}
$functionDeclaration = $this->expressionCache->get($functionName);
if (!$functionDeclaration) {
$functionDeclaration = $this->generateEvaluatorCode($expression);
$this->expressionCache->set($functionName, $functionDeclaration);
}
$expressionFunction = eval($functionDeclaration);
$this->evaluatedExpressions[$functionName] = $expressionFunction;
return $this->evaluateAndUnwrap($expressionFunction, $context);
} | php | public function evaluate($expression, Context $context)
{
$expression = trim($expression);
$identifier = md5($expression);
$functionName = 'expression_' . $identifier;
if (isset($this->evaluatedExpressions[$functionName])) {
return $this->evaluateAndUnwrap($this->evaluatedExpressions[$functionName], $context);
}
$functionDeclaration = $this->expressionCache->get($functionName);
if (!$functionDeclaration) {
$functionDeclaration = $this->generateEvaluatorCode($expression);
$this->expressionCache->set($functionName, $functionDeclaration);
}
$expressionFunction = eval($functionDeclaration);
$this->evaluatedExpressions[$functionName] = $expressionFunction;
return $this->evaluateAndUnwrap($expressionFunction, $context);
} | [
"public",
"function",
"evaluate",
"(",
"$",
"expression",
",",
"Context",
"$",
"context",
")",
"{",
"$",
"expression",
"=",
"trim",
"(",
"$",
"expression",
")",
";",
"$",
"identifier",
"=",
"md5",
"(",
"$",
"expression",
")",
";",
"$",
"functionName",
... | Evaluate an expression under a given context
@param string $expression
@param Context $context
@return mixed | [
"Evaluate",
"an",
"expression",
"under",
"a",
"given",
"context"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Eel/Classes/CompilingEvaluator.php#L54-L72 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.setServers | protected function setServers(array $servers)
{
$this->servers = $servers;
if (!count($this->servers)) {
throw new Exception('No servers were given to Memcache', 1213115903);
}
$this->memcache = extension_loaded('memcached') ? new \MemCached() : new \Memcache();
$defaultPort = ini_get('memcache.default_port') ?: 11211;
foreach ($this->servers as $server) {
$host = $server;
$port = 0;
if (strpos($server, 'tcp://') === 0) {
$port = $defaultPort;
$server = substr($server, 6);
if (strpos($server, ':') !== false) {
list($host, $port) = explode(':', $server, 2);
}
}
$this->memcache->addServer($host, $port);
}
} | php | protected function setServers(array $servers)
{
$this->servers = $servers;
if (!count($this->servers)) {
throw new Exception('No servers were given to Memcache', 1213115903);
}
$this->memcache = extension_loaded('memcached') ? new \MemCached() : new \Memcache();
$defaultPort = ini_get('memcache.default_port') ?: 11211;
foreach ($this->servers as $server) {
$host = $server;
$port = 0;
if (strpos($server, 'tcp://') === 0) {
$port = $defaultPort;
$server = substr($server, 6);
if (strpos($server, ':') !== false) {
list($host, $port) = explode(':', $server, 2);
}
}
$this->memcache->addServer($host, $port);
}
} | [
"protected",
"function",
"setServers",
"(",
"array",
"$",
"servers",
")",
"{",
"$",
"this",
"->",
"servers",
"=",
"$",
"servers",
";",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"servers",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'No s... | Setter for servers to be used. Expects an array, the values are expected
to be formatted like "<host>[:<port>]" or "unix://<path>"
@param array $servers An array of servers to add.
@return void
@throws Exception
@api | [
"Setter",
"for",
"servers",
"to",
"be",
"used",
".",
"Expects",
"an",
"array",
"the",
"values",
"are",
"expected",
"to",
"be",
"formatted",
"like",
"<host",
">",
"[",
":",
"<port",
">",
"]",
"or",
"unix",
":",
"//",
"<path",
">"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L105-L130 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.setCompression | protected function setCompression(bool $useCompression)
{
if ($this->memcache instanceof \Memcached) {
$this->memcache->setOption(\Memcached::OPT_COMPRESSION, $useCompression);
return;
}
if ($useCompression === true) {
$this->flags ^= MEMCACHE_COMPRESSED;
} else {
$this->flags &= ~MEMCACHE_COMPRESSED;
}
} | php | protected function setCompression(bool $useCompression)
{
if ($this->memcache instanceof \Memcached) {
$this->memcache->setOption(\Memcached::OPT_COMPRESSION, $useCompression);
return;
}
if ($useCompression === true) {
$this->flags ^= MEMCACHE_COMPRESSED;
} else {
$this->flags &= ~MEMCACHE_COMPRESSED;
}
} | [
"protected",
"function",
"setCompression",
"(",
"bool",
"$",
"useCompression",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"memcache",
"instanceof",
"\\",
"Memcached",
")",
"{",
"$",
"this",
"->",
"memcache",
"->",
"setOption",
"(",
"\\",
"Memcached",
"::",
"O... | Setter for compression flags bit
@param boolean $useCompression
@return void
@api | [
"Setter",
"for",
"compression",
"flags",
"bit"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L139-L150 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.set | public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null)
{
if (strlen($this->identifierPrefix . $entryIdentifier) > 250) {
throw new \InvalidArgumentException('Could not set value. Key more than 250 characters (' . $this->identifierPrefix . $entryIdentifier . ').', 1232969508);
}
if (!$this->cache instanceof FrontendInterface) {
throw new Exception('No cache frontend has been set yet via setCache().', 1207149215);
}
$tags[] = '%MEMCACHEBE%' . $this->cacheIdentifier;
$expiration = $lifetime !== null ? $lifetime : $this->defaultLifetime;
// Memcache considers values over 2592000 sec (30 days) as UNIX timestamp
// thus $expiration should be converted from lifetime to UNIX timestamp
if ($expiration > 2592000) {
$expiration += time();
}
try {
if (strlen($data) > self::MAX_BUCKET_SIZE) {
$data = str_split($data, self::MAX_BUCKET_SIZE - 1024);
$success = true;
$chunkNumber = 1;
foreach ($data as $chunk) {
$success = $success && $this->setItem($this->identifierPrefix . $entryIdentifier . '_chunk_' . $chunkNumber, $chunk, $expiration);
$chunkNumber++;
}
$success = $success && $this->setItem($this->identifierPrefix . $entryIdentifier, 'Flow*chunked:' . $chunkNumber, $expiration);
} else {
$success = $this->setItem($this->identifierPrefix . $entryIdentifier, $data, $expiration);
}
if ($success === true) {
$this->removeIdentifierFromAllTags($entryIdentifier);
$this->addIdentifierToTags($entryIdentifier, $tags);
} else {
throw new Exception('Could not set value on memcache server.', 1275830266);
}
} catch (\Exception $exception) {
throw new Exception('Could not set value. ' . $exception->getMessage(), 1207208100);
}
} | php | public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null)
{
if (strlen($this->identifierPrefix . $entryIdentifier) > 250) {
throw new \InvalidArgumentException('Could not set value. Key more than 250 characters (' . $this->identifierPrefix . $entryIdentifier . ').', 1232969508);
}
if (!$this->cache instanceof FrontendInterface) {
throw new Exception('No cache frontend has been set yet via setCache().', 1207149215);
}
$tags[] = '%MEMCACHEBE%' . $this->cacheIdentifier;
$expiration = $lifetime !== null ? $lifetime : $this->defaultLifetime;
// Memcache considers values over 2592000 sec (30 days) as UNIX timestamp
// thus $expiration should be converted from lifetime to UNIX timestamp
if ($expiration > 2592000) {
$expiration += time();
}
try {
if (strlen($data) > self::MAX_BUCKET_SIZE) {
$data = str_split($data, self::MAX_BUCKET_SIZE - 1024);
$success = true;
$chunkNumber = 1;
foreach ($data as $chunk) {
$success = $success && $this->setItem($this->identifierPrefix . $entryIdentifier . '_chunk_' . $chunkNumber, $chunk, $expiration);
$chunkNumber++;
}
$success = $success && $this->setItem($this->identifierPrefix . $entryIdentifier, 'Flow*chunked:' . $chunkNumber, $expiration);
} else {
$success = $this->setItem($this->identifierPrefix . $entryIdentifier, $data, $expiration);
}
if ($success === true) {
$this->removeIdentifierFromAllTags($entryIdentifier);
$this->addIdentifierToTags($entryIdentifier, $tags);
} else {
throw new Exception('Could not set value on memcache server.', 1275830266);
}
} catch (\Exception $exception) {
throw new Exception('Could not set value. ' . $exception->getMessage(), 1207208100);
}
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"entryIdentifier",
",",
"string",
"$",
"data",
",",
"array",
"$",
"tags",
"=",
"[",
"]",
",",
"int",
"$",
"lifetime",
"=",
"null",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"identifierPref... | Saves data in the cache.
@param string $entryIdentifier An identifier for this specific cache entry
@param string $data The data to be stored
@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 Exception if no cache frontend has been set.
@throws \InvalidArgumentException if the identifier is not valid or the final memcached key is longer than 250 characters
@api | [
"Saves",
"data",
"in",
"the",
"cache",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L196-L235 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.setItem | protected function setItem(string $key, string $value, int $expiration)
{
if ($this->memcache instanceof \Memcached) {
return $this->memcache->set($key, $value, $expiration);
}
return $this->memcache->set($key, $value, $this->flags, $expiration);
} | php | protected function setItem(string $key, string $value, int $expiration)
{
if ($this->memcache instanceof \Memcached) {
return $this->memcache->set($key, $value, $expiration);
}
return $this->memcache->set($key, $value, $this->flags, $expiration);
} | [
"protected",
"function",
"setItem",
"(",
"string",
"$",
"key",
",",
"string",
"$",
"value",
",",
"int",
"$",
"expiration",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"memcache",
"instanceof",
"\\",
"Memcached",
")",
"{",
"return",
"$",
"this",
"->",
"memc... | Stores an item on the server
@param string $key
@param string $value
@param integer $expiration
@return boolean | [
"Stores",
"an",
"item",
"on",
"the",
"server"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L245-L251 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.get | public function get(string $entryIdentifier)
{
$value = $this->memcache->get($this->identifierPrefix . $entryIdentifier);
if (substr($value, 0, 13) === 'Flow*chunked:') {
list(, $chunkCount) = explode(':', $value);
$value = '';
for ($chunkNumber = 1; $chunkNumber < $chunkCount; $chunkNumber++) {
$value .= $this->memcache->get($this->identifierPrefix . $entryIdentifier . '_chunk_' . $chunkNumber);
}
}
return $value;
} | php | public function get(string $entryIdentifier)
{
$value = $this->memcache->get($this->identifierPrefix . $entryIdentifier);
if (substr($value, 0, 13) === 'Flow*chunked:') {
list(, $chunkCount) = explode(':', $value);
$value = '';
for ($chunkNumber = 1; $chunkNumber < $chunkCount; $chunkNumber++) {
$value .= $this->memcache->get($this->identifierPrefix . $entryIdentifier . '_chunk_' . $chunkNumber);
}
}
return $value;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"entryIdentifier",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"memcache",
"->",
"get",
"(",
"$",
"this",
"->",
"identifierPrefix",
".",
"$",
"entryIdentifier",
")",
";",
"if",
"(",
"substr",
"(",
"$... | Loads data from the cache.
@param string $entryIdentifier An identifier which describes the cache entry to load
@return mixed The cache entry's content as a string or false if the cache entry could not be loaded
@api | [
"Loads",
"data",
"from",
"the",
"cache",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L260-L271 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.has | public function has(string $entryIdentifier): bool
{
return $this->memcache->get($this->identifierPrefix . $entryIdentifier) !== false;
} | php | public function has(string $entryIdentifier): bool
{
return $this->memcache->get($this->identifierPrefix . $entryIdentifier) !== false;
} | [
"public",
"function",
"has",
"(",
"string",
"$",
"entryIdentifier",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"memcache",
"->",
"get",
"(",
"$",
"this",
"->",
"identifierPrefix",
".",
"$",
"entryIdentifier",
")",
"!==",
"false",
";",
"}"
] | Checks if a cache entry with the specified identifier exists.
@param string $entryIdentifier An identifier specifying the cache entry
@return boolean true if such an entry exists, false if not
@api | [
"Checks",
"if",
"a",
"cache",
"entry",
"with",
"the",
"specified",
"identifier",
"exists",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L280-L283 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.remove | public function remove(string $entryIdentifier): bool
{
$this->removeIdentifierFromAllTags($entryIdentifier);
return $this->memcache->delete($this->identifierPrefix . $entryIdentifier);
} | php | public function remove(string $entryIdentifier): bool
{
$this->removeIdentifierFromAllTags($entryIdentifier);
return $this->memcache->delete($this->identifierPrefix . $entryIdentifier);
} | [
"public",
"function",
"remove",
"(",
"string",
"$",
"entryIdentifier",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"removeIdentifierFromAllTags",
"(",
"$",
"entryIdentifier",
")",
";",
"return",
"$",
"this",
"->",
"memcache",
"->",
"delete",
"(",
"$",
"this",
... | Removes all cache entries matching the specified identifier.
Usually this only affects one entry but if - for what reason ever -
old entries for the identifier still exist, they are removed as well.
@param string $entryIdentifier Specifies the cache entry to remove
@return boolean true if (at least) an entry could be removed or false if no entry was found
@api | [
"Removes",
"all",
"cache",
"entries",
"matching",
"the",
"specified",
"identifier",
".",
"Usually",
"this",
"only",
"affects",
"one",
"entry",
"but",
"if",
"-",
"for",
"what",
"reason",
"ever",
"-",
"old",
"entries",
"for",
"the",
"identifier",
"still",
"exi... | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L294-L298 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.findIdentifiersByTag | public function findIdentifiersByTag(string $tag): array
{
$identifiers = $this->memcache->get($this->identifierPrefix . 'tag_' . $tag);
if ($identifiers !== false) {
return (array) $identifiers;
}
return [];
} | php | public function findIdentifiersByTag(string $tag): array
{
$identifiers = $this->memcache->get($this->identifierPrefix . 'tag_' . $tag);
if ($identifiers !== false) {
return (array) $identifiers;
}
return [];
} | [
"public",
"function",
"findIdentifiersByTag",
"(",
"string",
"$",
"tag",
")",
":",
"array",
"{",
"$",
"identifiers",
"=",
"$",
"this",
"->",
"memcache",
"->",
"get",
"(",
"$",
"this",
"->",
"identifierPrefix",
".",
"'tag_'",
".",
"$",
"tag",
")",
";",
... | Finds and returns all cache entry identifiers which are tagged by the
specified tag.
@param string $tag The tag to search for
@return array An array with identifiers of all matching entries. An empty array if no entries matched
@api | [
"Finds",
"and",
"returns",
"all",
"cache",
"entry",
"identifiers",
"which",
"are",
"tagged",
"by",
"the",
"specified",
"tag",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L308-L315 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.findTagsByIdentifier | protected function findTagsByIdentifier(string $identifier): array
{
$tags = $this->memcache->get($this->identifierPrefix . 'ident_' . $identifier);
return ($tags === false ? [] : (array)$tags);
} | php | protected function findTagsByIdentifier(string $identifier): array
{
$tags = $this->memcache->get($this->identifierPrefix . 'ident_' . $identifier);
return ($tags === false ? [] : (array)$tags);
} | [
"protected",
"function",
"findTagsByIdentifier",
"(",
"string",
"$",
"identifier",
")",
":",
"array",
"{",
"$",
"tags",
"=",
"$",
"this",
"->",
"memcache",
"->",
"get",
"(",
"$",
"this",
"->",
"identifierPrefix",
".",
"'ident_'",
".",
"$",
"identifier",
")... | Finds all tags for the given identifier. This function uses reverse tag
index to search for tags.
@param string $identifier Identifier to find tags by
@return array Array with tags | [
"Finds",
"all",
"tags",
"for",
"the",
"given",
"identifier",
".",
"This",
"function",
"uses",
"reverse",
"tag",
"index",
"to",
"search",
"for",
"tags",
"."
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L324-L328 |
neos/flow-development-collection | Neos.Cache/Classes/Backend/MemcachedBackend.php | MemcachedBackend.addIdentifierToTags | protected function addIdentifierToTags(string $entryIdentifier, array $tags)
{
foreach ($tags as $tag) {
// Update tag-to-identifier index
$identifiers = $this->findIdentifiersByTag($tag);
if (array_search($entryIdentifier, $identifiers) === false) {
$identifiers[] = $entryIdentifier;
$this->memcache->set($this->identifierPrefix . 'tag_' . $tag, $identifiers);
}
// Update identifier-to-tag index
$existingTags = $this->findTagsByIdentifier($entryIdentifier);
if (array_search($tag, $existingTags) === false) {
$this->memcache->set($this->identifierPrefix . 'ident_' . $entryIdentifier, array_merge($existingTags, $tags));
}
}
} | php | protected function addIdentifierToTags(string $entryIdentifier, array $tags)
{
foreach ($tags as $tag) {
// Update tag-to-identifier index
$identifiers = $this->findIdentifiersByTag($tag);
if (array_search($entryIdentifier, $identifiers) === false) {
$identifiers[] = $entryIdentifier;
$this->memcache->set($this->identifierPrefix . 'tag_' . $tag, $identifiers);
}
// Update identifier-to-tag index
$existingTags = $this->findTagsByIdentifier($entryIdentifier);
if (array_search($tag, $existingTags) === false) {
$this->memcache->set($this->identifierPrefix . 'ident_' . $entryIdentifier, array_merge($existingTags, $tags));
}
}
} | [
"protected",
"function",
"addIdentifierToTags",
"(",
"string",
"$",
"entryIdentifier",
",",
"array",
"$",
"tags",
")",
"{",
"foreach",
"(",
"$",
"tags",
"as",
"$",
"tag",
")",
"{",
"// Update tag-to-identifier index",
"$",
"identifiers",
"=",
"$",
"this",
"->"... | Associates the identifier with the given tags
@param string $entryIdentifier
@param array $tags
@return void | [
"Associates",
"the",
"identifier",
"with",
"the",
"given",
"tags"
] | train | https://github.com/neos/flow-development-collection/blob/a4484ef2a57e050dc9bd87c8481eeb250c7a36fa/Neos.Cache/Classes/Backend/MemcachedBackend.php#L369-L385 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.