PhpParameter extends AbstractModel implements ValueInterface Uses NamePart, TypePart, ValuePart
Represents a PHP parameter.
Tags
Interfaces, Classes and Traits
Table of Contents
- $description : string
- $expression : string
- $hasExpression : bool
- $hasValue : bool
- $name : string
- $passedByReference : bool
- $type : string
- $typeDescription : string
- $value : mixed
- __construct() : mixed
- Creates a new PHP parameter.
- create() : static
- Creates a new PHP parameter.
- getDescription() : string
- Returns this description.
- getDocblockTag() : ParamTag
- Returns a docblock tag for this parameter.
- getExpression() : string
- Returns the expression.
- getName() : string
- Returns the name.
- getType() : string
- Returns the type.
- getTypeDescription() : string
- Alias for getDescription().
- getValue() : null|bool|float|int|PhpConstant|string
- Returns the value.
- hasValue() : bool
- Checks whether a value or expression is set.
- isExpression() : bool
- Returns whether an expression is set.
- isPassedByReference() : bool
- Returns whether this parameter is passed by reference.
- setDescription() : $this
- Sets the description, which will also be used when generating a docblock.
- setExpression() : $this
- Sets an expression.
- setMultilineDescription() : $this
- Sets a multi-line description, which will also be used when generating a docblock.
- setName() : $this
- Sets the name.
- setPassedByReference() : $this
- Sets whether this parameter is passed by reference.
- setType() : $this
- Sets the type.
- setTypeDescription() : $this
- Alias for setDescription().
- setValue() : $this
- Sets the value.
- unsetExpression() : $this
- Unsets the expression.
- unsetValue() : $this
- Unsets the value.
- isPrimitive() : bool
- Returns whether the given value is a primitive.
Properties
$description
protected
string
$description
= ''
$expression
private
string
$expression
= ''
$hasExpression
private
bool
$hasExpression
= false
$hasValue
private
bool
$hasValue
= false
$name
private
string
$name
= ''
$passedByReference
private
bool
$passedByReference
= false
$type
private
string
$type
= ''
$typeDescription
private
string
$typeDescription
= ''
$value
private
mixed
$value
Methods
__construct()
Creates a new PHP parameter.
public
final __construct([string $name = '' ]) : mixed
Parameters
- $name : string = ''
-
the parameter name
Return values
mixed —create()
Creates a new PHP parameter.
public
static create([string $name = '' ]) : static
Parameters
- $name : string = ''
-
the parameter name
Return values
static —getDescription()
Returns this description.
public
getDescription() : string
Return values
string —getDocblockTag()
Returns a docblock tag for this parameter.
public
getDocblockTag() : ParamTag
Return values
ParamTag —getExpression()
Returns the expression.
public
getExpression() : string
Return values
string —getName()
Returns the name.
public
getName() : string
Return values
string —getType()
Returns the type.
public
getType() : string
Return values
string —getTypeDescription()
Alias for getDescription().
public
getTypeDescription() : string
Tags
Return values
string —getValue()
Returns the value.
public
getValue() : null|bool|float|int|PhpConstant|string
Return values
null|bool|float|int|PhpConstant|string —hasValue()
Checks whether a value or expression is set.
public
hasValue() : bool
Return values
bool —isExpression()
Returns whether an expression is set.
public
isExpression() : bool
Return values
bool —isPassedByReference()
Returns whether this parameter is passed by reference.
public
isPassedByReference() : bool
Return values
bool —true
if passed by reference and false
if not
setDescription()
Sets the description, which will also be used when generating a docblock.
public
setDescription(string $description) : $this
Parameters
- $description : string
Return values
$this —setExpression()
Sets an expression.
public
setExpression(string $expr) : $this
Parameters
- $expr : string
Return values
$this —setMultilineDescription()
Sets a multi-line description, which will also be used when generating a docblock.
public
setMultilineDescription(array<string|int, mixed> $description) : $this
Each line is a value of the $description
array.
Parameters
- $description : array<string|int, mixed>
Return values
$this —setName()
Sets the name.
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$this —setPassedByReference()
Sets whether this parameter is passed by reference.
public
setPassedByReference(bool $bool) : $this
Parameters
- $bool : bool
-
true
if passed by reference andfalse
if not
Return values
$this —setType()
Sets the type.
public
setType(string $type[, string $description = '' ]) : $this
Parameters
- $type : string
- $description : string = ''
Return values
$this —setTypeDescription()
Alias for setDescription().
public
setTypeDescription(string $description) : $this
Parameters
- $description : string
Tags
Return values
$this —setValue()
Sets the value.
public
setValue(mixed $value) : $this
Parameters
- $value : mixed
Tags
Return values
$this —unsetExpression()
Unsets the expression.
public
unsetExpression() : $this
Return values
$this —unsetValue()
Unsets the value.
public
unsetValue() : $this
Return values
$this —isPrimitive()
Returns whether the given value is a primitive.
private
isPrimitive(mixed $value) : bool
Parameters
- $value : mixed