PropertyWriteTag
extends PropertyTag
in package
Reflection class for a @property-write tag in a Docblock.
Tags
Table of Contents
- REGEX_TAGNAME = '[\w\-\_\\]+'
- PCRE regular expression matching a tag name.
- $content : string|null
- $description : string
- $docblock : DocBlock
- $isVariadic : bool
- $location : Location
- $parsedDescription : array<string|int, mixed>|null
- $tag : string
- $type : string
- $types : Collection
- $variableName : string
- $tagHandlerMappings : array<string|int, mixed>
- __construct() : mixed
- Parses a tag and populates the member variables.
- __toString() : string
- Returns the tag as a serialized string
- addType() : $this
- Add a type to the type section of the variable
- createInstance() : static
- Factory method responsible for instantiating the correct sub type.
- export() : void
- Builds a string representation of this object.
- getContent() : string
- Gets the content of this tag.
- getDescription() : string
- Gets the description component of this tag.
- getDocBlock() : DocBlock
- Gets the docblock this tag belongs to.
- getLocation() : Location
- Gets the location of the tag.
- getName() : string
- Gets the name of this tag.
- getParsedDescription() : array<string|int, mixed>
- Gets the parsed text of this description.
- getType() : string
- Returns the type section of the variable.
- getTypes() : array<string|int, string>
- Returns the unique types of the variable.
- getVariableName() : string
- Returns the variable's name.
- isVariadic() : bool
- Returns whether this tag is variadic.
- registerTagHandler() : bool
- Registers a handler for tags.
- setContent() : $this
- Sets the content of this tag.
- setDescription() : $this
- Sets the description component of this tag.
- setDocBlock() : $this
- Sets the docblock this tag belongs to.
- setLocation() : $this
- Sets the location of the tag.
- setName() : $this
- Sets the name of this tag.
- setType() : $this
- Set the type section of the variable
- setVariableName() : $this
- Sets the variable's name.
- getTypesCollection() : void
- Returns the type collection.
Constants
REGEX_TAGNAME
PCRE regular expression matching a tag name.
public
mixed
REGEX_TAGNAME
= '[\w\-\_\\]+'
Properties
$content
protected
string|null
$content
= ''
Content of the tag. When set to NULL, it means it needs to be regenerated.
$description
protected
string
$description
= ''
Description of the content of this tag
$docblock
protected
DocBlock
$docblock
= null
The DocBlock which this tag belongs to.
$isVariadic
protected
bool
$isVariadic
= false
determines whether this is a variadic argument
$location
protected
Location
$location
= null
Location of the tag.
$parsedDescription
protected
array<string|int, mixed>|null
$parsedDescription
= null
The description, as an array of strings and Tag objects. When set to NULL, it means it needs to be regenerated.
$tag
protected
string
$tag
= ''
Name of the tag
$type
protected
string
$type
= ''
The raw type component.
$types
protected
Collection
$types
= null
The parsed type component.
$variableName
protected
string
$variableName
= ''
$tagHandlerMappings
private
static array<string|int, mixed>
$tagHandlerMappings
= array('author' => '\Barryvdh\Reflection\DocBlock\Tag\AuthorTag', 'covers' => '\Barryvdh\Reflection\DocBlock\Tag\CoversTag', 'deprecated' => '\Barryvdh\Reflection\DocBlock\Tag\DeprecatedTag', 'example' => '\Barryvdh\Reflection\DocBlock\Tag\ExampleTag', 'link' => '\Barryvdh\Reflection\DocBlock\Tag\LinkTag', 'method' => '\Barryvdh\Reflection\DocBlock\Tag\MethodTag', 'param' => '\Barryvdh\Reflection\DocBlock\Tag\ParamTag', 'property-read' => '\Barryvdh\Reflection\DocBlock\Tag\PropertyReadTag', 'property' => '\Barryvdh\Reflection\DocBlock\Tag\PropertyTag', 'property-write' => '\Barryvdh\Reflection\DocBlock\Tag\PropertyWriteTag', 'return' => '\Barryvdh\Reflection\DocBlock\Tag\ReturnTag', 'see' => '\Barryvdh\Reflection\DocBlock\Tag\SeeTag', 'since' => '\Barryvdh\Reflection\DocBlock\Tag\SinceTag', 'source' => '\Barryvdh\Reflection\DocBlock\Tag\SourceTag', 'throw' => '\Barryvdh\Reflection\DocBlock\Tag\ThrowsTag', 'throws' => '\Barryvdh\Reflection\DocBlock\Tag\ThrowsTag', 'uses' => '\Barryvdh\Reflection\DocBlock\Tag\UsesTag', 'var' => '\Barryvdh\Reflection\DocBlock\Tag\VarTag', 'version' => '\Barryvdh\Reflection\DocBlock\Tag\VersionTag')
An array with a tag as a key, and an FQCN to a class that handles it as an array value. The class is expected to inherit this class.
Methods
__construct()
Parses a tag and populates the member variables.
public
__construct(string $name, string $content[, DocBlock $docblock = null ][, Location $location = null ]) : mixed
Parameters
- $name : string
-
Name of the tag.
- $content : string
-
The contents of the given tag.
- $docblock : DocBlock = null
-
The DocBlock which this tag belongs to.
- $location : Location = null
-
Location of the tag.
Return values
mixed —__toString()
Returns the tag as a serialized string
public
__toString() : string
Return values
string —addType()
Add a type to the type section of the variable
public
addType(string $type) : $this
Parameters
- $type : string
Return values
$this —createInstance()
Factory method responsible for instantiating the correct sub type.
public
final static createInstance(string $tag_line[, DocBlock $docblock = null ][, Location $location = null ]) : static
Parameters
- $tag_line : string
-
The text for this tag, including description.
- $docblock : DocBlock = null
-
The DocBlock which this tag belongs to.
- $location : Location = null
-
Location of the tag.
Tags
Return values
static —A new tag object.
export()
Builds a string representation of this object.
public
static export() : void
Tags
Return values
void —getContent()
Gets the content of this tag.
public
getContent() : string
Return values
string —getDescription()
Gets the description component of this tag.
public
getDescription() : string
Return values
string —getDocBlock()
Gets the docblock this tag belongs to.
public
getDocBlock() : DocBlock
Return values
DocBlock —The docblock this tag belongs to.
getLocation()
Gets the location of the tag.
public
getLocation() : Location
Return values
Location —The tag's location.
getName()
Gets the name of this tag.
public
getName() : string
Return values
string —The name of this tag.
getParsedDescription()
Gets the parsed text of this description.
public
getParsedDescription() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of strings and tag objects, in the order they occur within the description.
getType()
Returns the type section of the variable.
public
getType() : string
Return values
string —getTypes()
Returns the unique types of the variable.
public
getTypes() : array<string|int, string>
Return values
array<string|int, string> —getVariableName()
Returns the variable's name.
public
getVariableName() : string
Return values
string —isVariadic()
Returns whether this tag is variadic.
public
isVariadic() : bool
Return values
bool —registerTagHandler()
Registers a handler for tags.
public
final static registerTagHandler(string $tag, string|null $handler) : bool
Registers a handler for tags. The class specified is autoloaded if it's not available. It must inherit from this class.
Parameters
- $tag : string
-
Name of tag to regiser a handler for. When registering a namespaced tag, the full name, along with a prefixing slash MUST be provided.
- $handler : string|null
-
FQCN of handler. Specifing NULL removes the handler for the specified tag, if any.
Return values
bool —TRUE on success, FALSE on failure.
setContent()
Sets the content of this tag.
public
setContent(string $content) : $this
Parameters
- $content : string
-
The new content of this tag.
Return values
$this —setDescription()
Sets the description component of this tag.
public
setDescription(string $description) : $this
Parameters
- $description : string
-
The new description component of this tag.
Return values
$this —setDocBlock()
Sets the docblock this tag belongs to.
public
setDocBlock([DocBlock $docblock = null ]) : $this
Parameters
- $docblock : DocBlock = null
-
The new docblock this tag belongs to. Setting NULL removes any association.
Return values
$this —setLocation()
Sets the location of the tag.
public
setLocation([Location $location = null ]) : $this
Parameters
- $location : Location = null
-
The new location of the tag.
Return values
$this —setName()
Sets the name of this tag.
public
setName(string $name) : $this
Parameters
- $name : string
-
The new name of this tag.
Tags
Return values
$this —setType()
Set the type section of the variable
public
setType(string $type) : $this
Parameters
- $type : string
Return values
$this —setVariableName()
Sets the variable's name.
public
setVariableName(string $name) : $this
Parameters
- $name : string
-
The new name for this variable.
Return values
$this —getTypesCollection()
Returns the type collection.
protected
getTypesCollection() : void