PicoraDocumentationMethod

Superset of ReflectionMethod

extends ReflectionMethod , ReflectionFunction implements ArrayAccess , Reflector

Similar to a ReflectionMethod object, except that when used as an array, you can access all of the comment information.

$c = new PicoraDocumentationMethod('MyDocumentedClass','myDocumentedMethod');
$c->name; //myDocumentedMethod
$c['description']; //string description in doc comment

You also get the following extra properties:

  • string file
  • string class
  • string visibility

Declared in: PicoraDocumentation.php

class PicoraDocumentationMethod extends ReflectionMethod implements ArrayAccess {
    protected $comment = array();
    public function __construct($class,$name){
        parent::__construct($class,$name);
        $this->comments = PicoraDocumentation::arrayFromDocComment($this->getDocComment());
        $this->comments['name'] = $name;
        $this->comments['class'] = $class;
        $this->comments['file'] = $this->getFileName();
        $this->comments['visibility'] = '';
        foreach(array('abstract','final','static','public','protected','private') as $v)
            if($this->{'is'.ucfirst($v)}())
                $this->comments['visibility'] .= $v.' ';
    }
    public function offsetExists($key){return isset($this->comments[$key]);}
    public function offsetSet($key,$value){$this->comments[$key] = $value;}
    public function offsetGet($key){return $this->comments[$key];}
    public function offsetUnset($key){unset($this->comments[$key]);}
}