PHPSA\Definition\ClassDefinition::hasMethod PHP Метод

hasMethod() публичный Метод

public hasMethod ( string $name, boolean | false $inherit = false ) : boolean
$name string
$inherit boolean | false
Результат boolean
    public function hasMethod($name, $inherit = false)
    {
        if (isset($this->methods[$name])) {
            return true;
        }
        if ($inherit && $this->extendsClassDefinition && $this->extendsClassDefinition->hasMethod($name, $inherit)) {
            $method = $this->extendsClassDefinition->getMethod($name, $inherit);
            return $method && ($method->isPublic() || $method->isProtected());
        }
        return false;
    }

Usage Example

Пример #1
0
 /**
  * @param string $name
  * @param boolean|false $inherit
  * @return bool
  */
 public function hasMethod($name, $inherit = false)
 {
     if (isset($this->methods[$name])) {
         return true;
     }
     if ($inherit && $this->extendsClassDefinition && $this->extendsClassDefinition->hasMethod($name, true)) {
         $method = $this->extendsClassDefinition->getMethod($name);
         return $method->isPublic() || $method->isProtected();
     }
     return false;
 }