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


PHP ReflectionService::getAllClassNames方法代码示例

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


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

示例1: showMethodsForPrivilegeTargetCommand

 /**
  * Shows the methods represented by the given security privilege target
  *
  * If the privilege target has parameters those can be specified separated by a colon
  * for example "parameter1:value1" "parameter2:value2".
  * But be aware that this only works for parameters that have been specified in the policy
  *
  * @param string $privilegeTarget The name of the privilegeTarget as stated in the policy
  * @return void
  */
 public function showMethodsForPrivilegeTargetCommand($privilegeTarget)
 {
     $privilegeTargetInstance = $this->policyService->getPrivilegeTargetByIdentifier($privilegeTarget);
     if ($privilegeTargetInstance === null) {
         $this->outputLine('The privilegeTarget "%s" is not defined', array($privilegeTarget));
         $this->quit(1);
     }
     $privilegeParameters = array();
     foreach ($this->request->getExceedingArguments() as $argument) {
         list($argumentName, $argumentValue) = explode(':', $argument, 2);
         $privilegeParameters[$argumentName] = $argumentValue;
     }
     $privilege = $privilegeTargetInstance->createPrivilege(PrivilegeInterface::GRANT, $privilegeParameters);
     if (!$privilege instanceof MethodPrivilegeInterface) {
         $this->outputLine('The privilegeTarget "%s" does not refer to a MethodPrivilege but to a privilege of type "%s"', array($privilegeTarget, $privilege->getPrivilegeTarget()->getPrivilegeClassName()));
         $this->quit(1);
     }
     $matchedClassesAndMethods = array();
     foreach ($this->reflectionService->getAllClassNames() as $className) {
         try {
             $reflectionClass = new \ReflectionClass($className);
         } catch (\ReflectionException $exception) {
             continue;
         }
         foreach ($reflectionClass->getMethods() as $reflectionMethod) {
             $methodName = $reflectionMethod->getName();
             if ($privilege->matchesMethod($className, $methodName)) {
                 $matchedClassesAndMethods[$className][$methodName] = $methodName;
             }
         }
     }
     if (count($matchedClassesAndMethods) === 0) {
         $this->outputLine('The given Resource did not match any method or is unknown.');
         $this->quit(1);
     }
     foreach ($matchedClassesAndMethods as $className => $methods) {
         $this->outputLine($className);
         foreach ($methods as $methodName) {
             $this->outputLine('  ' . $methodName);
         }
         $this->outputLine();
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:53,代码来源:SecurityCommandController.php

示例2: 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


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