当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::__construct方法代码示例

本文整理汇总了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 = '';
         }
     }
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:40,代码来源:ExampleTag.php

示例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];
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:16,代码来源:LinkTag.php

示例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]);
         }
     }
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:18,代码来源:AuthorTag.php

示例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);
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:23,代码来源:VarTag.php

示例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);
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:24,代码来源:ParamTag.php

示例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];
     }
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:30,代码来源:SourceTag.php

示例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;
     }
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:46,代码来源:MethodTag.php

示例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] : '';
     }
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:32,代码来源:VersionTag.php


注:本文中的phpDocumentor\Reflection\DocBlock\Tag::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。