本文整理汇总了PHP中TYPO3\Flow\Reflection\ReflectionService::getAllImplementationClassNamesForInterface方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionService::getAllImplementationClassNamesForInterface方法的具体用法?PHP ReflectionService::getAllImplementationClassNamesForInterface怎么用?PHP ReflectionService::getAllImplementationClassNamesForInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Reflection\ReflectionService
的用法示例。
在下文中一共展示了ReflectionService::getAllImplementationClassNamesForInterface方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeObject
/**
* Adds all validators that extend the AssetValidatorInterface.
*
* @return void
*/
protected function initializeObject()
{
$assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetValidatorInterface::class);
foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) {
$this->addValidator($this->objectManager->get($assetValidatorImplementationClassName));
}
}
示例2: initializeObject
/**
* Adds all validators that extend the AssetValidatorInterface.
*
* @return void
*/
protected function initializeObject()
{
$assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface('TYPO3\\Media\\Domain\\Validator\\AssetValidatorInterface');
foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) {
$this->addValidator($this->objectManager->get($assetValidatorImplementationClassName));
}
}
示例3: render
/**
* Returns the JavaScript to declare the Ext Direct provider for all
* controller actions that are annotated with "@TYPO3\ExtJS\Annotations\ExtDirect"
*
* = Examples =
*
* <code title="Simple">
* {namespace ext=TYPO3\ExtJS\ViewHelpers}
* ...
* <script type="text/javascript">
* <ext:extdirect.provider />
* </script>
* ...
* </code>
*
* TODO Cache ext direct provider config
* @param string $namespace The base ExtJS namespace (with dots) for the direct provider methods
* @return string JavaScript needed to include Ext Direct provider
* @api
*/
public function render($namespace = NULL)
{
$providerConfig = array('url' => '?TYPO3_ExtJS_ExtDirectRequest=1&__csrfToken=' . $this->securityContext->getCsrfProtectionToken(), 'type' => 'remoting', 'actions' => array());
if (!empty($namespace)) {
$providerConfig['namespace'] = $namespace;
}
$controllerClassNames = $this->localReflectionService->getAllImplementationClassNamesForInterface('TYPO3\\Flow\\Mvc\\Controller\\ControllerInterface');
foreach ($controllerClassNames as $controllerClassName) {
$methodNames = get_class_methods($controllerClassName);
foreach ($methodNames as $methodName) {
$methodTagsValues = $this->localReflectionService->getMethodTagsValues($controllerClassName, $methodName);
if (isset($methodTagsValues['extdirect'])) {
$methodParameters = $this->localReflectionService->getMethodParameters($controllerClassName, $methodName);
$requiredMethodParametersCount = 0;
foreach ($methodParameters as $methodParameter) {
if ($methodParameter['optional'] === TRUE) {
break;
}
$requiredMethodParametersCount++;
}
$extDirectAction = str_replace('\\', '_', $controllerClassName);
$providerConfig['actions'][$extDirectAction][] = array('name' => substr($methodName, 0, -6), 'len' => $requiredMethodParametersCount);
}
}
}
return 'Ext.Direct.addProvider(' . json_encode($providerConfig) . ');' . chr(10);
}
示例4: getExtractorAdapters
/**
* @return array
* @throws UnknownObjectException
*/
protected function getExtractorAdapters()
{
$extractorAdapterClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(ExtractorInterface::class);
$extractorAdapters = [];
/** @var ExtractorInterface $className */
foreach ($extractorAdapterClassNames as $className) {
$extractorAdapters[$className] = $className::getCompatibleMediaTypes();
}
return $extractorAdapters;
}
示例5: getDomainCommands
/**
* @return Cli\Command[]
*/
protected function getDomainCommands()
{
$cliCommands = [];
$domainCommandClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(Domain\CommandInterface::class);
foreach ($domainCommandClassNames as $domainCommandClassName) {
if ($this->reflectionService->isClassAbstract($domainCommandClassName) === TRUE) {
continue;
}
$cliCommands[] = $this->buildDomainCommand($domainCommandClassName);
}
return $cliCommands;
}
示例6: initializeObject
/**
* @return void
*/
public function initializeObject()
{
$this->imageVariantClassNames = $this->reflectionService->getAllSubClassNamesForClass('TYPO3\\Media\\Domain\\Model\\ImageVariant');
array_unshift($this->imageVariantClassNames, 'TYPO3\\Media\\Domain\\Model\\ImageVariant');
$this->assetClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface('TYPO3\\Media\\Domain\\Model\\AssetInterface');
$this->dateTimeClassNames = $this->reflectionService->getAllSubClassNamesForClass('DateTime');
array_unshift($this->dateTimeClassNames, 'DateTime');
}
示例7: initializeObject
/**
* @return void
*/
public function initializeObject()
{
$this->imageVariantClassNames = $this->reflectionService->getAllSubClassNamesForClass(ImageVariant::class);
array_unshift($this->imageVariantClassNames, ImageVariant::class);
$this->assetClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetInterface::class);
$this->dateTimeClassNames = $this->reflectionService->getAllSubClassNamesForClass('DateTime');
array_unshift($this->dateTimeClassNames, 'DateTime');
}
示例8: getUsageStrategies
/**
* Returns all registered asset usage strategies
*
* @return array<\TYPO3\Media\Domain\Strategy\AssetUsageStrategyInterface>
* @throws \TYPO3\Flow\Object\Exception\UnknownObjectException
*/
protected function getUsageStrategies()
{
if (is_array($this->usageStrategies)) {
return $this->usageStrategies;
}
$assetUsageStrategieImplementations = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetUsageStrategyInterface::class);
foreach ($assetUsageStrategieImplementations as $assetUsageStrategieImplementationClassName) {
$this->usageStrategies[] = $this->objectManager->get($assetUsageStrategieImplementationClassName);
}
return $this->usageStrategies;
}
示例9: initializeConverters
/**
* @return void
*/
protected function initializeConverters()
{
$this->resourceInformation = array();
foreach ($this->reflectionService->getAllImplementationClassNamesForInterface(ResourceInformationInterface::class) as $resourceInformationClassName) {
$this->resourceInformation[] = $this->objectManager->get($resourceInformationClassName);
}
usort($this->resourceInformation, function (ResourceInformationInterface $first, ResourceInformationInterface $second) {
if ($first->getPriority() == $second->getPriority()) {
return strcmp(TypeHandling::getTypeForValue($first), TypeHandling::getTypeForValue($second));
} else {
return $first->getPriority() < $second->getPriority();
}
});
}
示例10: reduceTargetClassNames
/**
* This method is used to optimize the matching process.
*
* @param \TYPO3\Flow\Aop\Builder\ClassNameIndex $classNameIndex
* @return \TYPO3\Flow\Aop\Builder\ClassNameIndex
*/
public function reduceTargetClassNames(\TYPO3\Flow\Aop\Builder\ClassNameIndex $classNameIndex)
{
if (interface_exists($this->interfaceOrClassName)) {
$classNames = $this->reflectionService->getAllImplementationClassNamesForInterface($this->interfaceOrClassName);
} elseif (class_exists($this->interfaceOrClassName)) {
$classNames = $this->reflectionService->getAllSubClassNamesForClass($this->interfaceOrClassName);
$classNames[] = $this->interfaceOrClassName;
} else {
$classNames = array();
}
$filteredIndex = new \TYPO3\Flow\Aop\Builder\ClassNameIndex();
$filteredIndex->setClassNames($classNames);
return $classNameIndex->intersect($filteredIndex);
}
示例11: initializeObject
/**
* Initializer, building up $this->operations and $this->finalOperationNames
*/
public function initializeObject()
{
$operationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface('TYPO3\\Eel\\FlowQuery\\OperationInterface');
/** @var $operationClassName OperationInterface */
foreach ($operationClassNames as $operationClassName) {
$shortOperationName = $operationClassName::getShortName();
$operationPriority = $operationClassName::getPriority();
$isFinalOperation = $operationClassName::isFinal();
if (!isset($this->operations[$shortOperationName])) {
$this->operations[$shortOperationName] = array();
}
if (isset($this->operations[$shortOperationName][$operationPriority])) {
throw new FlowQueryException(sprintf('Operation with name "%s" and priority %s is already defined in class %s, and the class %s has the same priority and name.', $shortOperationName, $operationPriority, $this->operations[$shortOperationName][$operationPriority], $operationClassName), 1332491678);
}
$this->operations[$shortOperationName][$operationPriority] = $operationClassName;
if ($isFinalOperation) {
$this->finalOperationNames[$shortOperationName] = $shortOperationName;
}
}
foreach ($this->operations as &$operation) {
krsort($operation, SORT_NUMERIC);
}
}
示例12: getAffectedClassNames
/**
* @param array $classesSelector
* @return array
*/
protected function getAffectedClassNames(array $classesSelector)
{
if (isset($classesSelector['parentClassName'])) {
$affectedClassNames = $this->reflectionService->getAllSubClassNamesForClass($classesSelector['parentClassName']);
} elseif (isset($classesSelector['interface'])) {
$affectedClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface($classesSelector['interface']);
} elseif (isset($classesSelector['classesContainingMethodsAnnotatedWith'])) {
$affectedClassNames = $this->reflectionService->getClassesContainingMethodsAnnotatedWith($classesSelector['classesContainingMethodsAnnotatedWith']);
} else {
$affectedClassNames = $this->reflectionService->getAllClassNames();
}
foreach ($affectedClassNames as $index => $className) {
if ($this->reflectionService->isClassAbstract($className) && (!isset($classesSelector['includeAbstractClasses']) || $classesSelector['includeAbstractClasses'] === FALSE)) {
unset($affectedClassNames[$index]);
} elseif (isset($classesSelector['classNamePattern']) && preg_match($classesSelector['classNamePattern'], $className) === 0) {
unset($affectedClassNames[$index]);
}
}
return $affectedClassNames;
}
示例13: buildObjectConfigurations
/**
* 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<TYPO3\Flow\Object\Configuration\Configuration> Object configurations
* @throws InvalidObjectConfigurationException
*/
public function buildObjectConfigurations(array $availableClassAndInterfaceNamesByPackage, array $rawObjectConfigurationsByPackages)
{
$objectConfigurations = array();
$interfaceNames = array();
foreach ($availableClassAndInterfaceNamesByPackage as $packageKey => $classAndInterfaceNames) {
foreach ($classAndInterfaceNames as $classOrInterfaceName) {
$objectName = $classOrInterfaceName;
if ($this->reflectionService->isClassUnconfigurable($classOrInterfaceName)) {
continue;
}
if ($this->reflectionService->isClassFinal($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, \TYPO3\Flow\Annotations\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 = array('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:
foreach (array_keys($interfaceNames) as $interfaceName) {
$implementationClassName = $objectConfigurations[$interfaceName]->getClassName();
if ($implementationClassName !== '' && isset($objectConfigurations[$implementationClassName])) {
$objectConfigurations[$interfaceName]->setScope($objectConfigurations[$implementationClassName]->getScope());
}
}
$this->autowireArguments($objectConfigurations);
$this->autowireProperties($objectConfigurations);
return $objectConfigurations;
}
示例14: modelAction
/**
* @param string $application
* @throws \Exception
* @return string
*/
public function modelAction($application)
{
if ($this->modelDefinitionUtility instanceof DependencyProxy) {
$this->modelDefinitionUtility->_activateDependency();
}
$configuration = \TYPO3\Flow\Utility\Arrays::getValueByPath($this->settings, array('applications', $application, 'model'));
if (empty($configuration)) {
throw new \Exception('Application Model configuration not found');
}
$packageKeys = array();
$models = array();
// Find packages
if (isset($configuration['packageFolderPatterns']) && is_array($configuration['packageFolderPatterns'])) {
foreach ($configuration['packageFolderPatterns'] as $pattern) {
$packageFolders = glob(FLOW_PATH_PACKAGES . $pattern);
foreach ($packageFolders as $packageFolder) {
if (!in_array(basename($packageFolder), $packageKeys)) {
$packageKeys[] = basename($packageFolder);
}
}
}
}
// Find ModelFinder implementations
$modelFinders = array();
$modelFinderImplementations = $this->reflectionService->getAllImplementationClassNamesForInterface('Radmiraal\\Emberjs\\Utility\\ModelFinderUtilityInterface');
foreach ($modelFinderImplementations as $modelFinderClassName) {
$finder = new $modelFinderClassName();
foreach ($packageKeys as $packageKey) {
$finder->findModelImplementations($packageKey, $models);
}
$modelFinders[] = $finder;
}
$foundRelations = array();
$code = '';
foreach ($models as $model => $properties) {
if (is_array($this->settings['applications'][$application]['model']['ignoredModels']) && in_array($model, $this->settings['applications'][$application]['model']['ignoredModels'])) {
continue;
}
$code .= $this->modelDefinitionUtility->getModelDeclaration($model, $properties, $application, $foundRelations);
}
// Traverse over relations we picked up and are not yet found in the $models array
$recursionCounter = 0;
while (array_diff($foundRelations, array_keys($models)) !== array() && $recursionCounter < 10) {
foreach (array_diff($foundRelations, array_keys($models)) as $modelName) {
if (is_array($this->settings['applications'][$application]['model']['ignoredModels']) && in_array($modelName, $this->settings['applications'][$application]['model']['ignoredModels'])) {
continue;
}
foreach ($modelFinders as $modelFinder) {
if ($modelFinder->canRead($modelName) === TRUE) {
if (isset($models[$modelName])) {
continue;
}
$models[$modelName] = $modelFinder->findModelProperties($modelName);
$code .= $this->modelDefinitionUtility->getModelDeclaration($modelName, $models[$modelName], $application, $foundRelations);
}
}
}
$recursionCounter++;
}
return $code;
}