PhpFunction
class PhpFunction extends AbstractModel implements GenerateableInterface, NamespaceInterface, DocblockInterface, RoutineInterface
Represents a PHP function.
Traits
Methods
Sets the description, which will also be used when generating a docblock
Sets the long description
A quick way to add a parameter which is created from the given parameters
A quick way to add a parameter with description which is created from the given parameters
Returns a parameter by index or name
In contrast to setName(), this method accepts the fully qualified name including the namespace.
Set true if a reference is returned of false if not
Creates a new PHP function
Creates a new PHP function
No description
Details
in AbstractModel at line line 19
string
getDescription()
Returns this description
in AbstractModel at line line 29
$this
setDescription(string|array $description)
Sets the description, which will also be used when generating a docblock
in BodyPart at line line 22
$this
setBody(string $body)
Sets the body for this
in BodyPart at line line 33
string
getBody()
Returns the body
in DocblockPart at line line 24
$this
setDocblock(Docblock|string $doc)
Sets the docblock
in DocblockPart at line line 39
Docblock
getDocblock()
Returns the docblock
in LongDescriptionPart at line line 21
string
getLongDescription()
Returns the long description
in LongDescriptionPart at line line 31
$this
setLongDescription(string $longDescription)
Sets the long description
in ParametersPart at line line 31
$this
setParameters(array $parameters)
Sets a collection of parameters
Note: clears all parameters before setting the new ones
in ParametersPart at line line 46
$this
addParameter(PhpParameter $parameter)
Adds a parameter
in ParametersPart at line line 58
bool
hasParameter(string $name)
Checks whether a parameter exists
in ParametersPart at line line 77
$this
addSimpleParameter(string $name, null|string $type = null, mixed $defaultValue = null)
A quick way to add a parameter which is created from the given parameters
in ParametersPart at line line 99
$this
addSimpleDescParameter(string $name, null|string $type = null, null|string $typeDescription = null, mixed $defaultValue = null)
A quick way to add a parameter with description which is created from the given parameters
in ParametersPart at line line 119
PhpParameter
getParameter(string|int $nameOrIndex)
Returns a parameter by index or name
in ParametersPart at line line 142
$this
replaceParameter(int $position, PhpParameter $parameter)
Replaces a parameter at a given position
in ParametersPart at line line 155
$this
removeParameter(int|string|PhpParameter $param)
Remove a parameter at a given position
in ParametersPart at line line 197
array
getParameters()
Returns a collection of parameters
in NamePart at line line 22
$this
setName(string $name)
Sets the name
in NamePart at line line 33
string
getName()
Returns the name
in QualifiedNamePart at line line 24
$this
setNamespace(string $namespace)
Sets the namespace
in QualifiedNamePart at line line 37
$this
setQualifiedName(string $name)
In contrast to setName(), this method accepts the fully qualified name including the namespace.
in QualifiedNamePart at line line 56
string
getNamespace()
Returns the namespace
in QualifiedNamePart at line line 65
string
getQualifiedName()
Returns the qualified name
in ReferenceReturnPart at line line 22
$this
setReferenceReturned(bool $bool)
Set true if a reference is returned of false if not
in ReferenceReturnPart at line line 33
bool
isReferenceReturned()
Returns whether a reference is returned
in TypePart at line line 51
string
getType()
Returns the type
in TypePart at line line 60
string
getTypeDescription()
Returns the type description
in TypePart at line line 26
$this
setType(string $type, string $description = null)
Sets the type
in TypePart at line line 41
$this
setTypeDescription(string $description)
Sets the description for the type
at line line 56
static PhpFunction
fromReflection(ReflectionFunction $ref)
deprecated
deprecated
Creates a PHP function from reflection
at line line 82
static PhpFunction
create(string $name = null)
Creates a new PHP function
at line line 91
__construct(string $name = null)
Creates a new PHP function