class PhpConstant extends AbstractModel implements GenerateableInterface, DocblockInterface, ValueInterface

Represents a PHP constant.

Traits

Docblock Part
Long description part
Name part
Type docblock generator part
Type part
Value part

Methods

string
getDescription()

Returns this description

$this
setDescription(string|array $description)

Sets the description, which will also be used when generating a docblock

$this
setDocblock(Docblock|string $doc)

Sets the docblock

Docblock
getDocblock()

Returns the docblock

string
getLongDescription()

Returns the long description

$this
setLongDescription(string $longDescription)

Sets the long description

$this
setName(string $name)

Sets the name

from NamePart
string
getName()

Returns the name

from NamePart
string
getType()

Returns the type

from TypePart
string
getTypeDescription()

Returns the type description

from TypePart
$this
setType(string $type, string $description = null)

Sets the type

from TypePart
$this
setTypeDescription(string $description)

Sets the description for the type

from TypePart
$this
setDefaultValue(mixed $value) deprecated

No description

from ValuePart
$this
unsetDefaultValue() deprecated

No description

from ValuePart
mixed
getDefaultValue() deprecated

No description

from ValuePart
bool
hasDefaultValue() deprecated

No description

from ValuePart
$this
setValue(string|integer|float|bool|null|PhpConstant $value)

Sets the value

from ValuePart
$this
unsetValue()

Unsets the value

from ValuePart
string|integer|float|bool|null|PhpConstant
getValue()

Returns the value

from ValuePart
bool
hasValue()

Checks whether a value or expression is set

from ValuePart
bool
isExpression()

Returns whether an expression is set

from ValuePart
$this
setExpression(string $expr)

Sets an expression

from ValuePart
string
getExpression()

Returns the expression

from ValuePart
$this
unsetExpression()

Unsets the expression

from ValuePart
static PhpConstant
create(string $name = null, mixed $value = null, bool $isExpression = false)

Creates a new PHP constant

__construct(string $name = null, mixed $value = null, bool $isExpression = false)

Creates a new PHP constant

generateDocblock()

No description

Details

in AbstractModel at line line 19
string getDescription()

Returns this description

Return Value

string

in AbstractModel at line line 29
$this setDescription(string|array $description)

Sets the description, which will also be used when generating a docblock

Parameters

string|array $description

Return Value

$this

in DocblockPart at line line 24
$this setDocblock(Docblock|string $doc)

Sets the docblock

Parameters

Docblock|string $doc

Return Value

$this

in DocblockPart at line line 39
Docblock getDocblock()

Returns the docblock

Return Value

Docblock

in LongDescriptionPart at line line 21
string getLongDescription()

Returns the long description

Return Value

string

in LongDescriptionPart at line line 31
$this setLongDescription(string $longDescription)

Sets the long description

Parameters

string $longDescription

Return Value

$this

in NamePart at line line 22
$this setName(string $name)

Sets the name

Parameters

string $name

Return Value

$this

in NamePart at line line 33
string getName()

Returns the name

Return Value

string

in TypePart at line line 51
string getType()

Returns the type

Return Value

string

in TypePart at line line 60
string getTypeDescription()

Returns the type description

Return Value

string

in TypePart at line line 26
$this setType(string $type, string $description = null)

Sets the type

Parameters

string $type
string $description

Return Value

$this

in TypePart at line line 41
$this setTypeDescription(string $description)

Sets the description for the type

Parameters

string $description

Return Value

$this

in ValuePart at line line 32
$this setDefaultValue(mixed $value) deprecated

deprecated use `setValue()` instead

Parameters

mixed $value

Return Value

$this

in ValuePart at line line 40
$this unsetDefaultValue() deprecated

deprecated use `unsetValue()` instead

Return Value

$this

in ValuePart at line line 48
mixed getDefaultValue() deprecated

deprecated use `getValue()` instead

Return Value

mixed

in ValuePart at line line 56
bool hasDefaultValue() deprecated

deprecated use `hasValue()` instead

Return Value

bool

in ValuePart at line line 82
$this setValue(string|integer|float|bool|null|PhpConstant $value)

Sets the value

Parameters

string|integer|float|bool|null|PhpConstant $value

Return Value

$this

Exceptions

InvalidArgumentException if the value is not an accepted primitve

in ValuePart at line line 97
$this unsetValue()

Unsets the value

Return Value

$this

in ValuePart at line line 109
string|integer|float|bool|null|PhpConstant getValue()

Returns the value

Return Value

string|integer|float|bool|null|PhpConstant

in ValuePart at line line 118
bool hasValue()

Checks whether a value or expression is set

Return Value

bool

in ValuePart at line line 127
bool isExpression()

Returns whether an expression is set

Return Value

bool

in ValuePart at line line 137
$this setExpression(string $expr)

Sets an expression

Parameters

string $expr

Return Value

$this

in ValuePart at line line 149
string getExpression()

Returns the expression

Return Value

string

in ValuePart at line line 158
$this unsetExpression()

Unsets the expression

Return Value

$this

at line line 35
static PhpConstant create(string $name = null, mixed $value = null, bool $isExpression = false)

Creates a new PHP constant

Parameters

string $name
mixed $value
bool $isExpression

Return Value

PhpConstant

at line line 46
__construct(string $name = null, mixed $value = null, bool $isExpression = false)

Creates a new PHP constant

Parameters

string $name
mixed $value
bool $isExpression

at line line 60
generateDocblock()