You are here

class ParamTag in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Tag/ParamTag.php \phpDocumentor\Reflection\DocBlock\Tag\ParamTag

Reflection class for a @author Mike van Riel <mike.vanriel@naenius.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\ReturnTag
      • class \phpDocumentor\Reflection\DocBlock\Tag\ParamTag

Expanded class hierarchy of ParamTag

File

vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Tag/ParamTag.php, line 24

Namespace

phpDocumentor\Reflection\DocBlock\Tag
View source
class ParamTag extends ReturnTag {

  /** @var string */
  protected $variableName = '';

  /** @var bool determines whether this is a variadic argument */
  protected $isVariadic = false;

  /**
   * {@inheritdoc}
   */
  public function getContent() {
    if (null === $this->content) {
      $this->content = "{$this->type} {$this->variableName} {$this->description}";
    }
    return $this->content;
  }

  /**
   * {@inheritdoc}
   */
  public function setContent($content) {
    Tag::setContent($content);
    $parts = preg_split('/(\\s+)/Su', $this->description, 3, PREG_SPLIT_DELIM_CAPTURE);

    // if the first item that is encountered is not a variable; it is a type
    if (isset($parts[0]) && strlen($parts[0]) > 0 && $parts[0][0] !== '$') {
      $this->type = array_shift($parts);
      array_shift($parts);
    }

    // if the next item starts with a $ or ...$ it must be the variable name
    if (isset($parts[0]) && strlen($parts[0]) > 0 && ($parts[0][0] == '$' || substr($parts[0], 0, 4) === '...$')) {
      $this->variableName = array_shift($parts);
      array_shift($parts);
      if (substr($this->variableName, 0, 3) === '...') {
        $this->isVariadic = true;
        $this->variableName = substr($this->variableName, 3);
      }
    }
    $this
      ->setDescription(implode('', $parts));
    $this->content = $content;
    return $this;
  }

  /**
   * Returns the variable's name.
   *
   * @return string
   */
  public function getVariableName() {
    return $this->variableName;
  }

  /**
   * Sets the variable's name.
   *
   * @param string $name The new name for this variable.
   *
   * @return $this
   */
  public function setVariableName($name) {
    $this->variableName = $name;
    $this->content = null;
    return $this;
  }

  /**
   * Returns whether this tag is variadic.
   *
   * @return boolean
   */
  public function isVariadic() {
    return $this->isVariadic;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParamTag::$isVariadic protected property @var bool determines whether this is a variadic argument
ParamTag::$variableName protected property @var string
ParamTag::getContent public function Gets the content of this tag. Overrides ReturnTag::getContent
ParamTag::getVariableName public function Returns the variable's name.
ParamTag::isVariadic public function Returns whether this tag is variadic.
ParamTag::setContent public function Sets the content of this tag. Overrides ReturnTag::setContent
ParamTag::setVariableName public function Sets the variable's name.
ReturnTag::$type protected property @var string The raw type component.
ReturnTag::$types protected property @var Collection The parsed type component.
ReturnTag::getType public function Returns the type section of the variable.
ReturnTag::getTypes public function Returns the unique types of the variable.
ReturnTag::getTypesCollection protected function Returns the type collection.
Tag::$content protected property When set to NULL, it means it needs to be regenerated.
Tag::$description protected property @var string Description of the content of this tag
Tag::$docblock protected property @var DocBlock The DocBlock which this tag belongs to.
Tag::$location protected property @var Location Location of the tag.
Tag::$parsedDescription protected property When set to NULL, it means it needs to be regenerated.
Tag::$tag protected property @var string Name of the tag
Tag::$tagHandlerMappings private static property handles it as an array value. The class is expected to inherit this class.
Tag::createInstance final public static function Factory method responsible for instantiating the correct sub type.
Tag::export public static function Builds a string representation of this object.
Tag::getDescription public function Gets the description component of this tag.
Tag::getDocBlock public function Gets the docblock this tag belongs to.
Tag::getLocation public function Gets the location of the tag.
Tag::getName public function Gets the name of this tag.
Tag::getParsedDescription public function Gets the parsed text of this description.
Tag::REGEX_TAGNAME constant PCRE regular expression matching a tag name.
Tag::registerTagHandler final public static function Registers a handler for tags.
Tag::setDescription public function Sets the description component of this tag.
Tag::setDocBlock public function Sets the docblock this tag belongs to.
Tag::setLocation public function Sets the location of the tag.
Tag::setName public function Sets the name of this tag.
Tag::__construct public function Parses a tag and populates the member variables.
Tag::__toString public function Returns the tag as a serialized string