/**
  * @param  \Illuminate\Routing\Route  $route
  *
  * @return string
  */
 protected function getRouteDescription($route)
 {
     list($class, $method) = explode('@', $route);
     $reflection = new ReflectionClass($class);
     $reflectionMethod = $reflection->getMethod($method);
     $comment = $reflectionMethod->getDocComment();
     $phpdoc = new DocBlock($comment);
     return ['short' => $phpdoc->getShortDescription(), 'long' => $phpdoc->getLongDescription()->getContents()];
 }
Ejemplo n.º 2
0
    public function testTagCaseSensitivity()
    {
        $fixture = <<<DOCBLOCK
/**
 * This is a short description.
 *
 * This is a long description.
 *
 * @method null something()
 * @Method({"GET", "POST"})
 */
DOCBLOCK;
        $object = new DocBlock($fixture);
        $this->assertEquals('This is a short description.', $object->getShortDescription());
        $this->assertEquals('This is a long description.', $object->getLongDescription()->getContents());
        $tags = $object->getTags();
        $this->assertCount(2, $tags);
        $this->assertTrue($object->hasTag('method'));
        $this->assertTrue($object->hasTag('Method'));
        $this->assertInstanceOf(__NAMESPACE__ . '\\DocBlock\\Tag\\MethodTag', $tags[0]);
        $this->assertInstanceOf(__NAMESPACE__ . '\\DocBlock\\Tag', $tags[1]);
        $this->assertNotInstanceOf(__NAMESPACE__ . '\\DocBlock\\Tag\\MethodTag', $tags[1]);
    }