class ExampleTag in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Tag/ExampleTag.php \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag
Reflection class for a @example tag in a Docblock.
@author Vasil Rangelov <boen.robot@gmail.com> @license http://www.opensource.org/licenses/mit-license.php MIT @link http://phpdoc.org
Hierarchy
- class \phpDocumentor\Reflection\DocBlock\Tag implements \phpDocumentor\Reflection\DocBlock\Reflector
- class \phpDocumentor\Reflection\DocBlock\Tag\SourceTag
- class \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag
- class \phpDocumentor\Reflection\DocBlock\Tag\SourceTag
Expanded class hierarchy of ExampleTag
File
- vendor/
phpdocumentor/ reflection-docblock/ src/ phpDocumentor/ Reflection/ DocBlock/ Tag/ ExampleTag.php, line 24
Namespace
phpDocumentor\Reflection\DocBlock\TagView source
class ExampleTag extends SourceTag {
/**
* @var string Path to a file to use as an example.
* May also be an absolute URI.
*/
protected $filePath = '';
/**
* @var bool Whether the file path component represents an URI.
* This determines how the file portion appears at {@link getContent()}.
*/
protected $isURI = false;
/**
* {@inheritdoc}
*/
public function getContent() {
if (null === $this->content) {
$filePath = '';
if ($this->isURI) {
if (false === strpos($this->filePath, ':')) {
$filePath = str_replace('%2F', '/', rawurlencode($this->filePath));
}
else {
$filePath = $this->filePath;
}
}
else {
$filePath = '"' . $this->filePath . '"';
}
$this->content = $filePath . ' ' . parent::getContent();
}
return $this->content;
}
/**
* {@inheritdoc}
*/
public function setContent($content) {
Tag::setContent($content);
if (preg_match('/^
# File component
(?:
# File path in quotes
\\"([^\\"]+)\\"
|
# File URI
(\\S+)
)
# Remaining content (parsed by SourceTag)
(?:\\s+(.*))?
$/sux', $this->description, $matches)) {
if ('' !== $matches[1]) {
$this
->setFilePath($matches[1]);
}
else {
$this
->setFileURI($matches[2]);
}
if (isset($matches[3])) {
parent::setContent($matches[3]);
}
else {
$this
->setDescription('');
}
$this->content = $content;
}
return $this;
}
/**
* Returns the file path.
*
* @return string Path to a file to use as an example.
* May also be an absolute URI.
*/
public function getFilePath() {
return $this->filePath;
}
/**
* Sets the file path.
*
* @param string $filePath The new file path to use for the example.
*
* @return $this
*/
public function setFilePath($filePath) {
$this->isURI = false;
$this->filePath = trim($filePath);
$this->content = null;
return $this;
}
/**
* Sets the file path as an URI.
*
* This function is equivalent to {@link setFilePath()}, except that it
* convers an URI to a file path before that.
*
* There is no getFileURI(), as {@link getFilePath()} is compatible.
*
* @param type $uri The new file URI to use as an example.
*/
public function setFileURI($uri) {
$this->isURI = true;
if (false === strpos($uri, ':')) {
//Relative URL
$this->filePath = rawurldecode(str_replace(array(
'/',
'\\',
), '%2F', $uri));
}
else {
//Absolute URL or URI.
$this->filePath = $uri;
}
$this->content = null;
return $this;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExampleTag:: |
protected | property | May also be an absolute URI. | |
ExampleTag:: |
protected | property | This determines how the file portion appears at {@link getContent()}. | |
ExampleTag:: |
public | function |
Gets the content of this tag. Overrides SourceTag:: |
|
ExampleTag:: |
public | function | Returns the file path. | |
ExampleTag:: |
public | function |
Sets the content of this tag. Overrides SourceTag:: |
|
ExampleTag:: |
public | function | Sets the file path. | |
ExampleTag:: |
public | function | Sets the file path as an URI. | |
SourceTag:: |
protected | property | means "to the end". | |
SourceTag:: |
protected | property | location. | |
SourceTag:: |
public | function | Returns the number of lines. | |
SourceTag:: |
public | function | Gets the starting line. | |
SourceTag:: |
public | function | Sets the number of lines. | |
SourceTag:: |
public | function | Sets the starting line. | |
Tag:: |
protected | property | When set to NULL, it means it needs to be regenerated. | |
Tag:: |
protected | property | @var string Description of the content of this tag | |
Tag:: |
protected | property | @var DocBlock The DocBlock which this tag belongs to. | |
Tag:: |
protected | property | @var Location Location of the tag. | |
Tag:: |
protected | property | When set to NULL, it means it needs to be regenerated. | |
Tag:: |
protected | property | @var string Name of the tag | |
Tag:: |
private static | property | handles it as an array value. The class is expected to inherit this class. | |
Tag:: |
final public static | function | Factory method responsible for instantiating the correct sub type. | |
Tag:: |
public static | function | Builds a string representation of this object. | |
Tag:: |
public | function | Gets the description component of this tag. | |
Tag:: |
public | function | Gets the docblock this tag belongs to. | |
Tag:: |
public | function | Gets the location of the tag. | |
Tag:: |
public | function | Gets the name of this tag. | |
Tag:: |
public | function | Gets the parsed text of this description. | |
Tag:: |
constant | PCRE regular expression matching a tag name. | ||
Tag:: |
final public static | function | Registers a handler for tags. | |
Tag:: |
public | function | Sets the description component of this tag. | |
Tag:: |
public | function | Sets the docblock this tag belongs to. | |
Tag:: |
public | function | Sets the location of the tag. | |
Tag:: |
public | function | Sets the name of this tag. | |
Tag:: |
public | function | Parses a tag and populates the member variables. | |
Tag:: |
public | function | Returns the tag as a serialized string |