class MethodTag extends Tag

Class MethodTag - Reflection class for a @method in a Docblock.

Constants

REGEX_TAGNAME

PCRE regular expression matching a tag name.

Properties

protected string $tag from Tag
protected string|null $content from Tag
protected string $description from Tag
protected array|null $parsedDescription from Tag
protected Location $location from Tag
protected DocBlock $docblock from Tag
protected string $methodName
protected string $arguments
protected string $type
protected bool $isStatic

Methods

static Tag
createInstance(string $tagLine, DocBlock $docblock = null, Location $location = null)

Factory method responsible for instantiating the correct sub type.

from Tag
static bool
registerTagHandler(string $tag, string|null $handler)

Registers a handler for tags.

from Tag
__construct(string $name, string $content, DocBlock $docblock = null, Location $location = null)

Parses a tag and populates the member variables.

from Tag
string
getTag()

No description

from Tag
string
getName()

Gets the name of this tag.

from Tag
Tag
setName(string $name)

Sets the name of this tag.

from Tag
string
getContent()

Gets the content of this tag.

Tag
setContent(string $content)

Sets the content of this tag.

string
getDescription()

Gets the description component of this tag.

from Tag
Tag
setDescription(string $description)

Sets the description component of this tag.

from Tag
array
getParsedDescription()

Gets the parsed text of this description.

from Tag
getDocBlock()

Gets the docblock this tag belongs to.

from Tag
Tag
setDocBlock(DocBlock $docblock = null)

Sets the docblock this tag belongs to.

from Tag
getLocation()

Gets the location of the tag.

from Tag
Tag
setLocation(Location $location = null)

Sets the location of the tag.

from Tag
static void
export()

Builds a string representation of this object.

from Tag
string
__toString()

Returns the tag as a serialized string

from Tag
setMethodName(string $methodName)

Sets the name of this method.

string
getMethodName()

Retrieves the method name.

setArguments(string $arguments)

Sets the arguments for this method.

string[]
getArguments()

Returns an array containing each argument as array of type and name.

bool
isStatic()

Checks whether the method tag describes a static method or not.

setIsStatic(bool $isStatic)

Sets a new value for whether the method is static or not.

Details

in Tag at line 103
final static Tag createInstance(string $tagLine, DocBlock $docblock = null, Location $location = null)

Factory method responsible for instantiating the correct sub type.

Parameters

string $tagLine The text for this tag, including description.
DocBlock $docblock The DocBlock which this tag belongs to.
Location $location Location of the tag.

Return Value

Tag A new tag object.

Exceptions

InvalidArgumentException if an invalid tag line was presented.

in Tag at line 146
final static bool registerTagHandler(string $tag, string|null $handler)

Registers a handler for tags.

Registers a handler for tags. The class specified is autoloaded if it's not available. It must inherit from this class.

Parameters

string $tag Name of tag to regiser a handler for. When registering a namespaced tag, the full name, along with a prefixing slash MUST be provided.
string|null $handler FQCN of handler. Specifing NULL removes the handler for the specified tag, if any.

Return Value

bool TRUE on success, FALSE on failure.

in Tag at line 174
__construct(string $name, string $content, DocBlock $docblock = null, Location $location = null)

Parses a tag and populates the member variables.

Parameters

string $name Name of the tag.
string $content The contents of the given tag.
DocBlock $docblock The DocBlock which this tag belongs to.
Location $location Location of the tag.

in Tag at line 186
string getTag()

Return Value

string

in Tag at line 196
string getName()

Gets the name of this tag.

Return Value

string The name of this tag.

in Tag at line 210
Tag setName(string $name)

Sets the name of this tag.

Parameters

string $name The new name of this tag.

Return Value

Tag

Exceptions

InvalidArgumentException When an invalid tag name is provided.

at line 34
string getContent()

Gets the content of this tag.

Return Value

string

at line 49
Tag setContent(string $content)

Sets the content of this tag.

Parameters

string $content The new content of this tag.

Return Value

Tag

in Tag at line 256
string getDescription()

Gets the description component of this tag.

Return Value

string

in Tag at line 268
Tag setDescription(string $description)

Sets the description component of this tag.

Parameters

string $description The new description component of this tag.

Return Value

Tag

in Tag at line 283
array getParsedDescription()

Gets the parsed text of this description.

Return Value

array An array of strings and tag objects, in the order they occur within the description.

in Tag at line 298
DocBlock getDocBlock()

Gets the docblock this tag belongs to.

Return Value

DocBlock The docblock this tag belongs to.

in Tag at line 310
Tag setDocBlock(DocBlock $docblock = null)

Sets the docblock this tag belongs to.

Parameters

DocBlock $docblock The new docblock this tag belongs to. Setting NULL removes any association.

Return Value

Tag

in Tag at line 322
Location getLocation()

Gets the location of the tag.

Return Value

Location The tag's location.

in Tag at line 334
Tag setLocation(Location $location = null)

Sets the location of the tag.

Parameters

Location $location The new location of the tag.

Return Value

Tag

in Tag at line 352
static void export()

Builds a string representation of this object.

Return Value

void

Exceptions

Exception

in Tag at line 362
string __toString()

Returns the tag as a serialized string

Return Value

string

at line 121
MethodTag setMethodName(string $methodName)

Sets the name of this method.

Parameters

string $methodName The name of the method.

Return Value

MethodTag

at line 134
string getMethodName()

Retrieves the method name.

Return Value

string

at line 146
MethodTag setArguments(string $arguments)

Sets the arguments for this method.

Parameters

string $arguments A comma-separated arguments line.

Return Value

MethodTag

at line 162
string[] getArguments()

Returns an array containing each argument as array of type and name.

Please note that the argument sub-array may only contain 1 element if no type was specified.

Return Value

string[]

at line 181
bool isStatic()

Checks whether the method tag describes a static method or not.

Return Value

bool TRUE if the method declaration is for a static method, FALSE otherwise.

at line 193
MethodTag setIsStatic(bool $isStatic)

Sets a new value for whether the method is static or not.

Parameters

bool $isStatic The new value to set.

Return Value

MethodTag