You are here

public function MethodTag::setContent in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Tag/MethodTag.php \phpDocumentor\Reflection\DocBlock\Tag\MethodTag::setContent()

Sets the content of this tag.

Parameters

string $content The new content of this tag.:

Return value

$this

Overrides ReturnTag::setContent

File

vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Tag/MethodTag.php, line 57

Class

MethodTag
Reflection class for a @method in a Docblock.

Namespace

phpDocumentor\Reflection\DocBlock\Tag

Code

public function setContent($content) {
  Tag::setContent($content);

  // 1. none or more whitespace
  // 2. optionally the keyword "static" followed by whitespace
  // 3. optionally a word with underscores followed by whitespace : as
  //    type for the return value
  // 4. then optionally a word with underscores followed by () and
  //    whitespace : as method name as used by phpDocumentor
  // 5. then a word with underscores, followed by ( and any character
  //    until a ) and whitespace : as method name with signature
  // 6. any remaining text : as description
  if (preg_match('/^
                # Static keyword
                # Declates a static method ONLY if type is also present
                (?:
                    (static)
                    \\s+
                )?
                # Return type
                (?:
                    ([\\w\\|_\\\\]+)
                    \\s+
                )?
                # Legacy method name (not captured)
                (?:
                    [\\w_]+\\(\\)\\s+
                )?
                # Method name
                ([\\w\\|_\\\\]+)
                # Arguments
                \\(([^\\)]*)\\)
                \\s*
                # Description
                (.*)
            $/sux', $this->description, $matches)) {
    list(, $static, $this->type, $this->method_name, $this->arguments, $this->description) = $matches;
    if ($static) {
      if (!$this->type) {
        $this->type = 'static';
      }
      else {
        $this->isStatic = true;
      }
    }
    else {
      if (!$this->type) {
        $this->type = 'void';
      }
    }
    $this->parsedDescription = null;
  }
  return $this;
}