class PhpMethod extends AbstractPhpMember implements RoutineInterface

Represents a PHP method.

Traits

Abstract Part
Body Part
Abstract Part
Parameters Part
Reference return part
Type docblock generator part
Docblock Part
Long description part
Name part
Type part

Constants

VISIBILITY_PRIVATE

Private visibility

VISIBILITY_PROTECTED

Protected visibility

VISIBILITY_PUBLIC

Public visibility

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
$this
setType(string $type, string $description = null)

Sets the type

from TypePart
$this
setTypeDescription(string $description)

Sets the description for the type

from TypePart
string
getType()

Returns the type

from TypePart
string
getTypeDescription()

Returns the type description

from TypePart
__construct(string $name)

Creates a new member

$this
setVisibility(string $visibility)

Sets the members visibility

string
getVisibility()

Returns the visibility state of this member

$this
setStatic(bool $bool)

Sets whether or not this member is static

bool
isStatic()

Returns whether this member is static

$this
setParent(AbstractPhpStruct|null $parent)

Sets the parent structure to which this member belongs

getParent()

Returns the parent structure to which this member belongs

bool
isAbstract()

Returns whether this is abstract

$this
setAbstract(bool $bool)

Sets this to abstract

$this
setBody(string $body)

Sets the body for this

from BodyPart
string
getBody()

Returns the body

from BodyPart
bool
isFinal()

Returns whether this is final

from FinalPart
$this
setFinal(bool $bool)

Sets this final

from FinalPart
$this
setParameters(array $parameters)

Sets a collection of parameters

$this
addParameter(PhpParameter $parameter)

Adds a parameter

bool
hasParameter(string $name)

Checks whether a parameter exists

$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

$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

getParameter(string|int $nameOrIndex)

Returns a parameter by index or name

$this
replaceParameter(int $position, PhpParameter $parameter)

Replaces a parameter at a given position

$this
removeParameter(int|string|PhpParameter $param)

Remove a parameter at a given position

array
getParameters()

Returns a collection of parameters

$this
setReferenceReturned(bool $bool)

Set true if a reference is returned of false if not

bool
isReferenceReturned()

Returns whether a reference is returned

static 
create(string $name)

Creates a new PHP method.

$this
generateDocblock()

Generates docblock based on provided information

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 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 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

at line line 52
__construct(string $name)

Creates a new member

Parameters

string $name the name of the member

in AbstractPhpMember at line line 87
$this setVisibility(string $visibility)

Sets the members visibility

Parameters

string $visibility the new visibility

Return Value

$this

See also

self::VISIBILITY_PUBLIC
self::VISIBILITY_PROTECTED
self::VISIBILITY_PRIVATE

in AbstractPhpMember at line line 104
string getVisibility()

Returns the visibility state of this member

Return Value

string the visibility

in AbstractPhpMember at line line 114
$this setStatic(bool $bool)

Sets whether or not this member is static

Parameters

bool $bool

Return Value

$this

in AbstractPhpMember at line line 125
bool isStatic()

Returns whether this member is static

Return Value

bool true if static and false if not

in AbstractPhpMember at line line 136
$this setParent(AbstractPhpStruct|null $parent)

Sets the parent structure to which this member belongs

Parameters

AbstractPhpStruct|null $parent

Return Value

$this

in AbstractPhpMember at line line 147
AbstractPhpStruct getParent()

Returns the parent structure to which this member belongs

Return Value

AbstractPhpStruct

in AbstractPart at line line 21
bool isAbstract()

Returns whether this is abstract

Return Value

bool true for abstract and false if not

in AbstractPart at line line 31
$this setAbstract(bool $bool)

Sets this to abstract

Parameters

bool $bool true for abstract and false if not

Return Value

$this

in BodyPart at line line 22
$this setBody(string $body)

Sets the body for this

Parameters

string $body

Return Value

$this

in BodyPart at line line 33
string getBody()

Returns the body

Return Value

string

in FinalPart at line line 21
bool isFinal()

Returns whether this is final

Return Value

bool true for final and false if not

in FinalPart at line line 31
$this setFinal(bool $bool)

Sets this final

Parameters

bool $bool true for final and false if not

Return Value

$this

in ParametersPart at line line 31
$this setParameters(array $parameters)

Sets a collection of parameters

Note: clears all parameters before setting the new ones

Parameters

array $parameters

Return Value

$this

in ParametersPart at line line 46
$this addParameter(PhpParameter $parameter)

Adds a parameter

Parameters

PhpParameter $parameter

Return Value

$this

in ParametersPart at line line 58
bool hasParameter(string $name)

Checks whether a parameter exists

Parameters

string $name parameter name

Return Value

bool true if a parameter exists and false if not

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

Parameters

string $name
null|string $type
mixed $defaultValue omit the argument to define no default value

Return Value

$this

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

Parameters

string $name
null|string $type
null|string $typeDescription
mixed $defaultValue omit the argument to define no default value

Return Value

$this

in ParametersPart at line line 119
PhpParameter getParameter(string|int $nameOrIndex)

Returns a parameter by index or name

Parameters

string|int $nameOrIndex

Return Value

PhpParameter

Exceptions

InvalidArgumentException

in ParametersPart at line line 142
$this replaceParameter(int $position, PhpParameter $parameter)

Replaces a parameter at a given position

Parameters

int $position
PhpParameter $parameter

Return Value

$this

Exceptions

InvalidArgumentException

in ParametersPart at line line 155
$this removeParameter(int|string|PhpParameter $param)

Remove a parameter at a given position

Parameters

int|string|PhpParameter $param

Return Value

$this

in ParametersPart at line line 197
array getParameters()

Returns a collection of parameters

Return Value

array

in ReferenceReturnPart at line line 22
$this setReferenceReturned(bool $bool)

Set true if a reference is returned of false if not

Parameters

bool $bool

Return Value

$this

in ReferenceReturnPart at line line 33
bool isReferenceReturned()

Returns whether a reference is returned

Return Value

bool

at line line 48
static create(string $name)

Creates a new PHP method.

Parameters

string $name the method name

at line line 60
$this generateDocblock()

Generates docblock based on provided information

Return Value

$this