本文整理汇总了PHP中phpDocumentor\Reflection\DocBlock\Tag::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::__construct方法的具体用法?PHP Tag::__construct怎么用?PHP Tag::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpDocumentor\Reflection\DocBlock\Tag
的用法示例。
在下文中一共展示了Tag::__construct方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Parses a tag and populates the member variables.
*
* @param string $type Tag identifier for this tag (should be 'example').
* @param string $content Contents for this tag.
* @param DocBlock $docblock The DocBlock which this tag belongs to.
* @param Location $location Location of the tag.
*/
public function __construct($type, $content, DocBlock $docblock = null, Location $location = null)
{
Tag::__construct($type, $content, $docblock, $location);
if (preg_match('/^
(?:
# File path in quotes
\\"([^\\"]+)\\"
|
# File URI
(\\S+)
)
# Remaining content (parsed by SourceTag)
(?:\\s+(.*))?
$/sux', $this->description, $matches)) {
if ('' !== $matches[1]) {
//Quoted file path.
$this->filePath = trim($matches[1]);
} elseif (false === strpos($matches[2], ':')) {
//Relative URL or a file path with no spaces in it.
$this->filePath = rawurldecode(str_replace(array('/', '\\'), '%2F', $matches[2]));
} else {
//Absolute URL or URI.
$this->filePath = $matches[2];
}
if (isset($matches[3])) {
parent::__construct($type, $matches[3]);
$this->content = $content;
} else {
$this->description = '';
}
}
}
示例2: __construct
/**
* Parses a tag and populates the member variables.
*
* @param string $type Tag identifier for this tag (should be 'link').
* @param string $content Contents for this tag.
* @param DocBlock $docblock The DocBlock which this tag belongs to.
* @param Location $location Location of the tag.
*/
public function __construct($type, $content, DocBlock $docblock = null, Location $location = null)
{
parent::__construct($type, $content, $docblock, $location);
$content = preg_split('/\\s+/u', $this->description, 2);
// any output is considered a type
$this->link = $content[0];
$this->description = isset($content[1]) ? $content[1] : $content[0];
}
示例3: __construct
/**
* Parses a tag and populates the member variables.
*
* @param string $type Tag identifier for this tag (should be 'author').
* @param string $content Contents for this tag.
* @param DocBlock $docblock The DocBlock which this tag belongs to.
* @param Location $location Location of the tag.
*/
public function __construct($type, $content, DocBlock $docblock = null, Location $location = null)
{
parent::__construct($type, $content, $docblock, $location);
if (preg_match('/^([^\\<]*)(\\<([^\\>]*)\\>)?$/', $this->description, $matches)) {
$this->name = trim($matches[1]);
if (isset($matches[3])) {
$this->email = trim($matches[3]);
}
}
}
示例4: __construct
/**
* Parses a tag and populates the member variables.
*
* @param string $type Tag identifier for this tag (should be 'var').
* @param string $content Contents for this tag.
* @param DocBlock $docblock The DocBlock which this tag belongs to.
* @param Location $location Location of the tag.
*/
public function __construct($type, $content, DocBlock $docblock = null, Location $location = null)
{
Tag::__construct($type, $content, $docblock, $location);
$content = preg_split('/\\s+/u', $this->description);
if (count($content) == 0) {
return;
}
// var always starts with the variable name
$this->type = array_shift($content);
// if the next item starts with a $ it must be the variable name
if (count($content) > 0 && strlen($content[0]) > 0 && $content[0][0] == '$') {
$this->variableName = array_shift($content);
}
$this->description = implode(' ', $content);
}
示例5: __construct
/**
* Parses a tag and populates the member variables.
*
* @param string $type Tag identifier for this tag (should be 'param').
* @param string $content Contents for this tag.
* @param DocBlock $docblock The DocBlock which this tag belongs to.
* @param Location $location Location of the tag.
*/
public function __construct($type, $content, DocBlock $docblock = null, Location $location = null)
{
Tag::__construct($type, $content, $docblock, $location);
$content = preg_split('/(\\s+)/u', $this->description, 3, PREG_SPLIT_DELIM_CAPTURE);
// if the first item that is encountered is not a variable; it is a type
if (isset($content[0]) && strlen($content[0]) > 0 && $content[0][0] !== '$') {
$this->type = array_shift($content);
array_shift($content);
}
// if the next item starts with a $ it must be the variable name
if (isset($content[0]) && strlen($content[0]) > 0 && $content[0][0] == '$') {
$this->variableName = array_shift($content);
array_shift($content);
}
$this->description = implode('', $content);
}
示例6: __construct
/**
* Parses a tag and populates the member variables.
*
* @param string $type Tag identifier for this tag (should be 'source').
* @param string $content Contents for this tag.
* @param DocBlock $docblock The DocBlock which this tag belongs to.
* @param Location $location Location of the tag.
*/
public function __construct($type, $content, DocBlock $docblock = null, Location $location = null)
{
parent::__construct($type, $content, $docblock, $location);
if (preg_match('/^
# Starting line
([1-9]\\d*)
\\s*
# Number of lines
(?:
((?1))
\\s+
)?
# Description
(.*)
$/sux', $this->description, $matches)) {
$this->startingLine = (int) $matches[1];
if (isset($matches[2]) && '' !== $matches[2]) {
$this->lineCount = (int) $matches[2];
}
$this->description = $matches[3];
}
}
示例7: __construct
/**
* Parses a tag and populates the member variables.
*
* @param string $type Tag identifier for this tag (should be 'method').
* @param string $content Contents for this tag.
* @param DocBlock $docblock The DocBlock which this tag belongs to.
* @param Location $location Location of the tag.
*/
public function __construct($type, $content, DocBlock $docblock = null, Location $location = null)
{
Tag::__construct($type, $content, $docblock, $location);
$matches = array();
// 1. none or more whitespace
// 2. optionally a word with underscores followed by whitespace : as
// type for the return value
// 3. then optionally a word with underscores followed by () and
// whitespace : as method name as used by phpDocumentor
// 4. then a word with underscores, followed by ( and any character
// until a ) and whitespace : as method name with signature
// 5. any remaining text : as description
if (preg_match('/^
# Return type
(?:
([\\w\\|_\\\\]+)
\\s+
)?
# Legacy method name (not captured)
(?:
[\\w_]+\\(\\)\\s+
)?
# Method name
([\\w\\|_\\\\]+)
# Arguments
\\(([^\\)]*)\\)
\\s*
# Description
(.*)
$/sux', $this->description, $matches)) {
list(, $this->type, $this->method_name, $this->arguments, $this->description) = $matches;
if (!$this->type) {
$this->type = 'void';
}
} else {
echo date('c') . ' ERR (3): @method contained invalid contents: ' . $this->content . PHP_EOL;
}
}
示例8: __construct
/**
* Parses a tag and populates the member variables.
*
* @param string $type Tag identifier for this tag (should be 'version').
* @param string $content Contents for this tag.
* @param DocBlock $docblock The DocBlock which this tag belongs to.
* @param Location $location Location of the tag.
*/
public function __construct($type, $content, DocBlock $docblock = null, Location $location = null)
{
parent::__construct($type, $content, $docblock, $location);
if (preg_match('/^
# The version vector
((?:
# Normal release vectors.
\\d\\S*
|
# VCS version vectors. Per PHPCS, they are expected to
# follow the form of the VCS name, followed by ":", followed
# by the version vector itself.
# By convention, popular VCSes like CVS, SVN and GIT use "$"
# around the actual version vector.
[^\\s\\:]+\\:\\s*\\$[^\\$]+\\$
))
\\s*
# The description
(.+)?
$/sux', $this->description, $matches)) {
$this->version = $matches[1];
$this->description = isset($matches[2]) ? $matches[2] : '';
}
}