BetterReflection\Reflection\ReflectionClass::getImmediateMethods PHP 메소드

getImmediateMethods() 공개 메소드

Get only the methods that this class implements (i.e. do not search up parent classes etc.)
public getImmediateMethods ( ) : BetterReflection\Reflection\ReflectionMethod[]
리턴 BetterReflection\Reflection\ReflectionMethod[]
    public function getImmediateMethods()
    {
        /* @var $methods \ReflectionMethod[] */
        $methods = array_map(function (ClassMethod $methodNode) {
            return ReflectionMethod::createFromNode($this->reflector, $methodNode, $this);
        }, $this->node->getMethods());
        $methodsByName = [];
        foreach ($methods as $method) {
            $methodsByName[$method->getName()] = $method;
        }
        return $methodsByName;
    }

Usage Example

예제 #1
0
파일: Template.php 프로젝트: nochso/writeme
 /**
  * getVisibleMethods returns only the methods that are visible according to `api.visibility`.
  *
  * @param \BetterReflection\Reflection\ReflectionClass $class
  *
  * @return \BetterReflection\Reflection\ReflectionMethod[]
  */
 public function getVisibleMethods(ReflectionClass $class)
 {
     try {
         $methods = $class->getMethods();
     } catch (IdentifierNotFound $e) {
         $methods = $class->getImmediateMethods();
     }
     return array_filter($methods, [$this, 'isMethodVisible']);
 }
All Usage Examples Of BetterReflection\Reflection\ReflectionClass::getImmediateMethods