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


PHP ReflectionService::isMethodPublic方法代码示例

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


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

示例1: matches

 /**
  * Checks if the specified method matches against the method name
  * expression.
  *
  * Returns TRUE if method name, visibility and arguments constraints match and the target
  * method is not final.
  *
  * @param string $className Ignored in this pointcut filter
  * @param string $methodName Name of the method to match against
  * @param string $methodDeclaringClassName Name of the class the method was originally declared in
  * @param mixed $pointcutQueryIdentifier Some identifier for this query - must at least differ from a previous identifier. Used for circular reference detection.
  * @return boolean TRUE if the class matches, otherwise FALSE
  * @throws \TYPO3\Flow\Aop\Exception
  */
 public function matches($className, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier)
 {
     $matchResult = preg_match('/^' . $this->methodNameFilterExpression . '$/', $methodName);
     if ($matchResult === false) {
         throw new \TYPO3\Flow\Aop\Exception('Error in regular expression', 1168876915);
     } elseif ($matchResult !== 1) {
         return false;
     }
     switch ($this->methodVisibility) {
         case 'public':
             if (!($methodDeclaringClassName !== null && $this->reflectionService->isMethodPublic($methodDeclaringClassName, $methodName))) {
                 return false;
             }
             break;
         case 'protected':
             if (!($methodDeclaringClassName !== null && $this->reflectionService->isMethodProtected($methodDeclaringClassName, $methodName))) {
                 return false;
             }
             break;
     }
     if ($methodDeclaringClassName !== null && $this->reflectionService->isMethodFinal($methodDeclaringClassName, $methodName)) {
         return false;
     }
     $methodArguments = $methodDeclaringClassName === null ? array() : $this->reflectionService->getMethodParameters($methodDeclaringClassName, $methodName);
     foreach (array_keys($this->methodArgumentConstraints) as $argumentName) {
         $objectAccess = explode('.', $argumentName, 2);
         $argumentName = $objectAccess[0];
         if (!array_key_exists($argumentName, $methodArguments)) {
             $this->systemLogger->log('The argument "' . $argumentName . '" declared in pointcut does not exist in method ' . $methodDeclaringClassName . '->' . $methodName, LOG_NOTICE);
             return false;
         }
     }
     return true;
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:48,代码来源:PointcutMethodNameFilter.php

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

示例3: resolveActionMethodName

 /**
  * Resolves and checks the current action method name
  *
  * @return string Method name of the current action
  * @throws NoSuchActionException
  * @throws InvalidActionVisibilityException
  */
 protected function resolveActionMethodName()
 {
     $actionMethodName = $this->request->getControllerActionName() . 'Action';
     if (!is_callable(array($this, $actionMethodName))) {
         throw new NoSuchActionException(sprintf('An action "%s" does not exist in controller "%s".', $actionMethodName, get_class($this)), 1186669086);
     }
     if (!$this->reflectionService->isMethodPublic(get_class($this), $actionMethodName)) {
         throw new InvalidActionVisibilityException(sprintf('The action "%s" in controller "%s" is not public!', $actionMethodName, get_class($this)), 1186669086);
     }
     return $actionMethodName;
 }
开发者ID:sakona999,项目名称:flow-login,代码行数:18,代码来源:ActionController.php

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


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