Esempio n. 1
0
    public function testDocBlockScannerDescriptions()
    {
        $docComment = <<<EOB
/**
 * Short Description
 *
 * Long Description
 * continued in the second line
 */
EOB;
        $tokenScanner = new DocBlockScanner($docComment);
        $this->assertEquals('Short Description', $tokenScanner->getShortDescription());
        $this->assertEquals('Long Description continued in the second line', $tokenScanner->getLongDescription());
        // windows-style line separators
        $docComment = str_replace("\n", "\r\n", $docComment);
        $tokenScanner = new DocBlockScanner($docComment);
        $this->assertEquals('Short Description', $tokenScanner->getShortDescription());
        $this->assertEquals('Long Description continued in the second line', $tokenScanner->getLongDescription());
    }
Esempio n. 2
0
    /**
     * Parse the DocBlock
     *
     * @return void
     */
    protected function reflect()
    {
        if ($this->isReflected) {
            return;
        }

        $docComment = $this->docComment; // localize variable

        // create a clean docComment
        $this->cleanDocComment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ ]{0,1}(.*)?#', '$1', $docComment);
        $this->cleanDocComment = ltrim($this->cleanDocComment,
                                       "\r\n"); // @todo should be changed to remove first and last empty line

        $scanner                = new DocBlockScanner($docComment);
        $this->shortDescription = ltrim($scanner->getShortDescription());
        $this->longDescription  = ltrim($scanner->getLongDescription());
        foreach ($scanner->getTags() as $tag) {
            $this->tags[] = $this->tagManager->createTag(ltrim($tag['name'], '@'), ltrim($tag['value']));
        }
        $this->isReflected = true;
    }
Esempio n. 3
0
    /**
     * Parse the docblock
     *
     * @return void
     */
    protected function reflect()
    {
        if ($this->isReflected) {
            return;
        }

        $docComment = $this->docComment; // localize variable

        // First remove doc block line starters
        $docComment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ ]{0,1}(.*)?#', '$1', $docComment);
        $docComment = ltrim($docComment, "\r\n"); // @todo should be changed to remove first and last empty line
        $this->cleanDocComment = $docComment;

        $scanner = new DocBlockScanner($docComment, $this->annotationManager);
        $this->shortDescription = $scanner->getShortDescription();
        $this->longDescription  = $scanner->getLongDescription();
        $this->tags             = $scanner->getTags();
        if ($this->annotationManager) {
            $this->annotations = $scanner->getAnnotations();
        }
        $this->isReflected = true;
    }