本文整理汇总了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();
}
}
示例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;
}