Exemplo n.º 1
0
 /**
  * _parseComment
  *
  * Cleans input comments of stars and /'s so it is more readable.
  * Creates a multi dimensional array. That contains semi parsed comments
  * 
  * Returns an array with the following
  * 'title' contains the title / first line of the doc-block
  * 'desc' contains the remainder of the doc block
  * 'tags' contains all the doc-blocks @tags.
  * 
  * @param string $comments The comment block to be cleaned
  * @return array Array of Filtered and separated comments
  **/
 protected function _parseComment($comments)
 {
     return DocblockTools::parseDocBlock($comments);
 }
Exemplo n.º 2
0
    /**
     * test that tag parsing is more forgiving of whitespace.
     *
     * @access public
     * @return void
     **/
    function testRelaxedTagParsing()
    {
        $comment = <<<EOD
\t\t/**
\t\t * @param int \$normal normal is a good param
\t\t * @param\t\t\t\tstring\t\t\$tabs\t\t\ttabs is a good param
\t\t * @param        string         \$spaces    spaces is a good param
\t\t * @param  string    \$spacestwo  spacestwo is a good param
\t\t *   it also has a newline
\t\t */
EOD;
        $result = DocblockTools::parseDocBlock($comment);
        $expected = array('normal' => array('type' => 'int', 'description' => 'normal is a good param'), 'tabs' => array('type' => 'string', 'description' => 'tabs is a good param'), 'spaces' => array('type' => 'string', 'description' => 'spaces is a good param'), 'spacestwo' => array('type' => 'string', 'description' => 'spacestwo is a good param it also has a newline'));
        $this->assertEqual(array_keys($result['tags']['param']), array_keys($expected), 'tag Keys do not match %s');
        $this->assertEqual($result['tags']['param']['normal'], $expected['normal']);
        $this->assertEqual($result['tags']['param']['tabs'], $expected['tabs']);
        $this->assertEqual($result['tags']['param']['spaces'], $expected['spaces']);
        $this->assertEqual($result['tags']['param']['spacestwo'], $expected['spacestwo']);
    }