mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Re-make Link tag in new image
This commit is contained in:
committed by
Mike van Riel
parent
5749b814fb
commit
21e6a9679a
+15
-32
@@ -12,42 +12,35 @@
|
|||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||||
|
|
||||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
use phpDocumentor\Reflection\DocBlock\Description;
|
||||||
|
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||||
|
use phpDocumentor\Reflection\Types\Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class for a @link tag in a Docblock.
|
* Reflection class for a @link tag in a Docblock.
|
||||||
*/
|
*/
|
||||||
class Link extends Tag
|
final class Link extends BaseTag
|
||||||
{
|
{
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $link = '';
|
private $link = '';
|
||||||
|
|
||||||
/**
|
public function __construct($link, Description $description)
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getContent()
|
|
||||||
{
|
{
|
||||||
if (null === $this->description) {
|
$this->link = $link;
|
||||||
$this->description = "{$this->link} {$this->description}";
|
$this->description = $description;
|
||||||
}
|
|
||||||
|
|
||||||
return $this->description;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function setContent($content)
|
public static function create($body, DescriptionFactory $descriptionFactory = null, Context $context = null)
|
||||||
{
|
{
|
||||||
parent::setContent($content);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
$parts = preg_split('/\s+/Su', $this->description, 2);
|
|
||||||
|
|
||||||
$this->link = $parts[0];
|
$link = $parts[0];
|
||||||
|
$description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context);
|
||||||
|
|
||||||
$this->setDescription(isset($parts[1]) ? $parts[1] : $parts[0]);
|
return new static($link, $description);
|
||||||
|
|
||||||
$this->description = $content;
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,18 +53,8 @@ class Link extends Tag
|
|||||||
return $this->link;
|
return $this->link;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function __toString()
|
||||||
* Sets the link
|
|
||||||
*
|
|
||||||
* @param string $link The link
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setLink($link)
|
|
||||||
{
|
{
|
||||||
$this->link = $link;
|
return $this->link . ' ' . $this->description;
|
||||||
|
|
||||||
$this->description = null;
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user