当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionService::getAllSubClassNamesForClass方法代码示例

本文整理汇总了PHP中TYPO3\Flow\Reflection\ReflectionService::getAllSubClassNamesForClass方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionService::getAllSubClassNamesForClass方法的具体用法?PHP ReflectionService::getAllSubClassNamesForClass怎么用?PHP ReflectionService::getAllSubClassNamesForClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\Flow\Reflection\ReflectionService的用法示例。


在下文中一共展示了ReflectionService::getAllSubClassNamesForClass方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: synchronizeCommand

 /**
  * Synchronize designs from Flow declarations to CouchDB documents
  *
  * @return void
  * @author Christopher Hlubek <hlubek@networkteam.com>
  */
 public function synchronizeCommand()
 {
     $designDocumentClassNames = $this->reflectionService->getAllSubClassNamesForClass('TYPO3\\CouchDB\\DesignDocument');
     foreach ($designDocumentClassNames as $objectName) {
         if ($this->objectManager->getScope($objectName) === \TYPO3\Flow\Object\Configuration\Configuration::SCOPE_SINGLETON) {
             $designDocument = $this->objectManager->get($objectName);
             $designDocument->synchronize();
             $this->outputLine($objectName . ' synchronized.');
         } else {
             $this->outputLine($objectName . ' skipped.');
         }
     }
 }
开发者ID:radmiraal,项目名称:TYPO3.CouchDB,代码行数:19,代码来源:DesignCommandController.php

示例2: getClassNamesInNamespace

 /**
  * Get all class names inside this namespace and return them as array.
  *
  * @param string $namespace
  * @return array Array of all class names inside a given namespace.
  */
 protected function getClassNamesInNamespace($namespace)
 {
     $affectedViewHelperClassNames = array();
     $allViewHelperClassNames = $this->reflectionService->getAllSubClassNamesForClass('TYPO3\\Fluid\\Core\\ViewHelper\\AbstractViewHelper');
     foreach ($allViewHelperClassNames as $viewHelperClassName) {
         if ($this->reflectionService->isClassAbstract($viewHelperClassName)) {
             continue;
         }
         if (strncmp($namespace, $viewHelperClassName, strlen($namespace)) === 0) {
             $affectedViewHelperClassNames[] = $viewHelperClassName;
         }
     }
     sort($affectedViewHelperClassNames);
     return $affectedViewHelperClassNames;
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:21,代码来源:AbstractGenerator.php

示例3: proxySubClassesOfClassToEnsureAdvices

 /**
  * Makes sure that any sub classes of an adviced class also build the advices array on construction.
  *
  * @param string $className The adviced class name
  * @param ClassNameIndex $targetClassNameCandidates target class names for advices
  * @param ClassNameIndex $treatedSubClasses Already treated (sub) classes to avoid duplication
  * @return ClassNameIndex The new collection of already treated classes
  */
 protected function proxySubClassesOfClassToEnsureAdvices($className, ClassNameIndex $targetClassNameCandidates, ClassNameIndex $treatedSubClasses)
 {
     if ($this->reflectionService->isClassReflected($className) === false) {
         return $treatedSubClasses;
     }
     if (trait_exists($className)) {
         return $treatedSubClasses;
     }
     if (interface_exists($className)) {
         return $treatedSubClasses;
     }
     $subClassNames = $this->reflectionService->getAllSubClassNamesForClass($className);
     foreach ($subClassNames as $subClassName) {
         if ($treatedSubClasses->hasClassName($subClassName)) {
             continue;
         }
         if ($this->reflectionService->isClassReflected($subClassName) === false || $targetClassNameCandidates->hasClassName($subClassName)) {
             continue;
         }
         $proxyClass = $this->compiler->getProxyClass($subClassName);
         if ($proxyClass === false) {
             continue;
         }
         $callBuildMethodsAndAdvicesArrayCode = "        if (method_exists(get_parent_class(), 'Flow_Aop_Proxy_buildMethodsAndAdvicesArray') && is_callable('parent::Flow_Aop_Proxy_buildMethodsAndAdvicesArray')) parent::Flow_Aop_Proxy_buildMethodsAndAdvicesArray();\n";
         $proxyClass->getConstructor()->addPreParentCallCode($callBuildMethodsAndAdvicesArrayCode);
         $proxyClass->getMethod('__wakeup')->addPreParentCallCode($callBuildMethodsAndAdvicesArrayCode);
     }
     $treatedSubClasses = $treatedSubClasses->union(new ClassNameIndex($subClassNames));
     return $treatedSubClasses;
 }
开发者ID:kitsunet,项目名称:flow-development-collection,代码行数:38,代码来源:ProxyClassBuilder.php

示例4: showUnprotectedActionsCommand

 /**
  * Lists all public controller actions not covered by the active security policy
  *
  * @return void
  */
 public function showUnprotectedActionsCommand()
 {
     $controllerClassNames = $this->reflectionService->getAllSubClassNamesForClass('TYPO3\\Flow\\Mvc\\Controller\\AbstractController');
     $allActionsAreProtected = TRUE;
     foreach ($controllerClassNames as $controllerClassName) {
         if ($this->reflectionService->isClassAbstract($controllerClassName)) {
             continue;
         }
         $methodNames = get_class_methods($controllerClassName);
         $foundUnprotectedAction = FALSE;
         foreach ($methodNames as $methodName) {
             if (preg_match('/.*Action$/', $methodName) === 0 || $this->reflectionService->isMethodPublic($controllerClassName, $methodName) === FALSE) {
                 continue;
             }
             if ($this->policyService->hasPolicyEntryForMethod($controllerClassName, $methodName) === FALSE) {
                 if ($foundUnprotectedAction === FALSE) {
                     $this->outputLine(PHP_EOL . '<b>' . $controllerClassName . '</b>');
                     $foundUnprotectedAction = TRUE;
                     $allActionsAreProtected = FALSE;
                 }
                 $this->outputLine('  ' . $methodName);
             }
         }
     }
     if ($allActionsAreProtected === TRUE) {
         $this->outputLine('All public controller actions are covered by your security policy. Good job!');
     }
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:33,代码来源:SecurityCommandController.php

示例5: 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');
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:11,代码来源:LegacySiteImportService.php

示例6: 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');
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:11,代码来源:SiteImportService.php

示例7: getAvailableCommands

 /**
  * Returns an array of all commands
  *
  * @return array<Command>
  * @api
  */
 public function getAvailableCommands()
 {
     if ($this->availableCommands === NULL) {
         $this->availableCommands = array();
         $commandControllerClassNames = $this->reflectionService->getAllSubClassNamesForClass('TYPO3\\Flow\\Cli\\CommandController');
         foreach ($commandControllerClassNames as $className) {
             if (!class_exists($className)) {
                 continue;
             }
             foreach (get_class_methods($className) as $methodName) {
                 if (substr($methodName, -7, 7) === 'Command') {
                     $this->availableCommands[] = new Command($className, substr($methodName, 0, -7));
                 }
             }
         }
     }
     return $this->availableCommands;
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:24,代码来源:CommandManager.php

示例8: buildClassnameConstraints

 /**
  * @return string
  */
 protected function buildClassnameConstraints()
 {
     $constraints = array('doc.classname=="' . addslashes($this->type) . '"');
     $subClassNames = $this->reflectionService->getAllSubClassNamesForClass($this->type);
     foreach ($subClassNames as $subClassName) {
         if (strpos($subClassName, 'AOPProxy') !== FALSE) {
             continue;
         }
         $constraints[] = 'doc.classname=="' . addslashes($subClassName) . '"';
     }
     return implode('||', $constraints);
 }
开发者ID:radmiraal,项目名称:TYPO3.CouchDB,代码行数:15,代码来源:QueryView.php

示例9: 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);
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:20,代码来源:PointcutClassTypeFilter.php

示例10: proxySubClassesOfClassToEnsureAdvices

 /**
  * Makes sure that any sub classes of an adviced class also build the advices array on construction.
  *
  * @param string $className The adviced class name
  * @param ClassNameIndex $targetClassNameCandidates target class names for advices
  * @param ClassNameIndex $treatedSubClasses Already treated (sub) classes to avoid duplication
  * @return ClassNameIndex The new collection of already treated classes
  */
 protected function proxySubClassesOfClassToEnsureAdvices($className, ClassNameIndex $targetClassNameCandidates, ClassNameIndex $treatedSubClasses)
 {
     if ($this->reflectionService->isClassReflected($className) === false) {
         return $treatedSubClasses;
     }
     if (trait_exists($className)) {
         return $treatedSubClasses;
     }
     if (interface_exists($className)) {
         return $treatedSubClasses;
     }
     $subClassNames = $this->reflectionService->getAllSubClassNamesForClass($className);
     foreach ($subClassNames as $subClassName) {
         if ($targetClassNameCandidates->hasClassName($subClassName)) {
             continue;
         }
         $treatedSubClasses = $this->addBuildMethodsAndAdvicesCodeToClass($subClassName, $treatedSubClasses);
     }
     return $treatedSubClasses;
 }
开发者ID:RafaelKa,项目名称:flow-development-collection,代码行数:28,代码来源:ProxyClassBuilder.php

示例11: 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;
 }
开发者ID:neos,项目名称:doctools,代码行数:24,代码来源:ReferenceCommandController.php

示例12: showUnprotectedActionsCommand

 /**
  * Lists all public controller actions not covered by the active security policy
  *
  * @return void
  */
 public function showUnprotectedActionsCommand()
 {
     $methodPrivileges = array();
     foreach ($this->policyService->getRoles(true) as $role) {
         $methodPrivileges = array_merge($methodPrivileges, $role->getPrivilegesByType(\TYPO3\Flow\Security\Authorization\Privilege\Method\MethodPrivilegeInterface::class));
     }
     $controllerClassNames = $this->reflectionService->getAllSubClassNamesForClass(\TYPO3\Flow\Mvc\Controller\AbstractController::class);
     $allActionsAreProtected = true;
     foreach ($controllerClassNames as $controllerClassName) {
         if ($this->reflectionService->isClassAbstract($controllerClassName)) {
             continue;
         }
         $methodNames = get_class_methods($controllerClassName);
         $foundUnprotectedAction = false;
         foreach ($methodNames as $methodName) {
             if (preg_match('/.*Action$/', $methodName) === 0 || $this->reflectionService->isMethodPublic($controllerClassName, $methodName) === false) {
                 continue;
             }
             /** @var MethodPrivilegeInterface $methodPrivilege */
             foreach ($methodPrivileges as $methodPrivilege) {
                 if ($methodPrivilege->matchesMethod($controllerClassName, $methodName)) {
                     continue 2;
                 }
             }
             if ($foundUnprotectedAction === false) {
                 $this->outputLine(PHP_EOL . '<b>' . $controllerClassName . '</b>');
                 $foundUnprotectedAction = true;
                 $allActionsAreProtected = false;
             }
             $this->outputLine('  ' . $methodName);
         }
     }
     if ($allActionsAreProtected === true) {
         $this->outputLine('All public controller actions are covered by your security policy. Good job!');
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:41,代码来源:SecurityCommandController.php

示例13: loadMetadataForClass


//.........这里部分代码省略.........
     // Evaluate SqlResultSetMappings annotation
     if (isset($classAnnotations['Doctrine\\ORM\\Mapping\\SqlResultSetMappings'])) {
         $sqlResultSetMappingsAnnotation = $classAnnotations['Doctrine\\ORM\\Mapping\\SqlResultSetMappings'];
         foreach ($sqlResultSetMappingsAnnotation->value as $resultSetMapping) {
             $entities = array();
             $columns = array();
             foreach ($resultSetMapping->entities as $entityResultAnnotation) {
                 $entityResult = array('fields' => array(), 'entityClass' => $entityResultAnnotation->entityClass, 'discriminatorColumn' => $entityResultAnnotation->discriminatorColumn);
                 foreach ($entityResultAnnotation->fields as $fieldResultAnnotation) {
                     $entityResult['fields'][] = array('name' => $fieldResultAnnotation->name, 'column' => $fieldResultAnnotation->column);
                 }
                 $entities[] = $entityResult;
             }
             foreach ($resultSetMapping->columns as $columnResultAnnotation) {
                 $columns[] = array('name' => $columnResultAnnotation->name);
             }
             $metadata->addSqlResultSetMapping(array('name' => $resultSetMapping->name, 'entities' => $entities, 'columns' => $columns));
         }
     }
     // Evaluate NamedQueries annotation
     if (isset($classAnnotations['Doctrine\\ORM\\Mapping\\NamedQueries'])) {
         $namedQueriesAnnotation = $classAnnotations['Doctrine\\ORM\\Mapping\\NamedQueries'];
         if (!is_array($namedQueriesAnnotation->value)) {
             throw new \UnexpectedValueException('@NamedQueries should contain an array of @NamedQuery annotations.');
         }
         foreach ($namedQueriesAnnotation->value as $namedQuery) {
             if (!$namedQuery instanceof NamedQuery) {
                 throw new \UnexpectedValueException('@NamedQueries should contain an array of @NamedQuery annotations.');
             }
             $metadata->addNamedQuery(array('name' => $namedQuery->name, 'query' => $namedQuery->query));
         }
     }
     // Evaluate InheritanceType annotation
     if (isset($classAnnotations['Doctrine\\ORM\\Mapping\\InheritanceType'])) {
         $inheritanceTypeAnnotation = $classAnnotations['Doctrine\\ORM\\Mapping\\InheritanceType'];
         $inheritanceType = constant('Doctrine\\ORM\\Mapping\\ClassMetadata::INHERITANCE_TYPE_' . strtoupper($inheritanceTypeAnnotation->value));
         if ($inheritanceType !== OrmClassMetadata::INHERITANCE_TYPE_NONE) {
             // Evaluate DiscriminatorColumn annotation
             if (isset($classAnnotations['Doctrine\\ORM\\Mapping\\DiscriminatorColumn'])) {
                 $discriminatorColumnAnnotation = $classAnnotations['Doctrine\\ORM\\Mapping\\DiscriminatorColumn'];
                 $discriminatorColumn = array('name' => $discriminatorColumnAnnotation->name, 'type' => $discriminatorColumnAnnotation->type, 'length' => $discriminatorColumnAnnotation->length, 'columnDefinition' => $discriminatorColumnAnnotation->columnDefinition);
             } else {
                 $discriminatorColumn = array('name' => 'dtype', 'type' => 'string', 'length' => 255);
             }
             // Evaluate DiscriminatorMap annotation
             if (isset($classAnnotations['Doctrine\\ORM\\Mapping\\DiscriminatorMap'])) {
                 $discriminatorMapAnnotation = $classAnnotations['Doctrine\\ORM\\Mapping\\DiscriminatorMap'];
                 $discriminatorMap = $discriminatorMapAnnotation->value;
             } else {
                 $discriminatorMap = array();
                 $subclassNames = $this->reflectionService->getAllSubClassNamesForClass($className);
                 if (!$this->reflectionService->isClassAbstract($className)) {
                     $mappedClassName = strtolower(str_replace('Domain_Model_', '', str_replace('\\', '_', $className)));
                     $discriminatorMap[$mappedClassName] = $className;
                 }
                 foreach ($subclassNames as $subclassName) {
                     $mappedSubclassName = strtolower(str_replace('Domain_Model_', '', str_replace('\\', '_', $subclassName)));
                     $discriminatorMap[$mappedSubclassName] = $subclassName;
                 }
             }
             if ($discriminatorMap !== array()) {
                 $metadata->setDiscriminatorColumn($discriminatorColumn);
                 $metadata->setDiscriminatorMap($discriminatorMap);
             } else {
                 $inheritanceType = OrmClassMetadata::INHERITANCE_TYPE_NONE;
             }
         }
         $metadata->setInheritanceType($inheritanceType);
     }
     // Evaluate DoctrineChangeTrackingPolicy annotation
     if (isset($classAnnotations['Doctrine\\ORM\\Mapping\\ChangeTrackingPolicy'])) {
         $changeTrackingAnnotation = $classAnnotations['Doctrine\\ORM\\Mapping\\ChangeTrackingPolicy'];
         $metadata->setChangeTrackingPolicy(constant('Doctrine\\ORM\\Mapping\\ClassMetadata::CHANGETRACKING_' . strtoupper($changeTrackingAnnotation->value)));
     } else {
         $metadata->setChangeTrackingPolicy(OrmClassMetadata::CHANGETRACKING_DEFERRED_EXPLICIT);
     }
     // Evaluate annotations on properties/fields
     try {
         $this->evaluatePropertyAnnotations($metadata);
     } catch (MappingException $exception) {
         throw new MappingException(sprintf('Failure while evaluating property annotations for class "%s": %s', $metadata->getName(), $exception->getMessage()), 1382003497, $exception);
     }
     // build unique index for table
     if (!isset($primaryTable['uniqueConstraints'])) {
         $idProperties = array_keys($classSchema->getIdentityProperties());
         if (array_diff($idProperties, $metadata->getIdentifierFieldNames()) !== array()) {
             $uniqueIndexName = $this->truncateIdentifier('flow_identity_' . $primaryTable['name']);
             foreach ($idProperties as $idProperty) {
                 $primaryTable['uniqueConstraints'][$uniqueIndexName]['columns'][] = isset($metadata->columnNames[$idProperty]) ? $metadata->columnNames[$idProperty] : strtolower($idProperty);
             }
         }
     }
     $metadata->setPrimaryTable($primaryTable);
     // Evaluate AssociationOverrides annotation
     $this->evaluateOverridesAnnotations($classAnnotations, $metadata);
     // Evaluate EntityListeners annotation
     $this->evaluateEntityListenersAnnotation($class, $metadata, $classAnnotations);
     // Evaluate @HasLifecycleCallbacks annotation
     $this->evaluateLifeCycleAnnotations($class, $metadata);
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:101,代码来源:FlowAnnotationDriver.php


注:本文中的TYPO3\Flow\Reflection\ReflectionService::getAllSubClassNamesForClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。