PHPSA\Definition\ClassDefinition::getMethod PHP Method

getMethod() public method

public getMethod ( $name, boolean | false $inherit = false ) : ClassMethod | null
$name
$inherit boolean | false
return ClassMethod | null
    public function getMethod($name, $inherit = false)
    {
        if (isset($this->methods[$name])) {
            return $this->methods[$name];
        }
        if ($inherit && $this->extendsClassDefinition) {
            return $this->extendsClassDefinition->getMethod($name, $inherit);
        }
        return null;
    }

Usage Example

Example #1
0
 /**
  * @param $name
  * @param boolean|false $inherit
  * @return ClassMethod
  */
 public function getMethod($name, $inherit = false)
 {
     if (isset($this->methods[$name])) {
         return $this->methods[$name];
     }
     return $inherit && $this->extendsClassDefinition && $this->extendsClassDefinition->getMethod($name, true);
 }