MethodReflection
extends ReflectionMethod
in package
implements
ReflectionInterface
Table of Contents
Interfaces
- ReflectionInterface
Constants
- PROTOTYPE_AS_ARRAY = 'prototype_as_array'
- Constant use in @MethodReflection to display prototype as an array
- PROTOTYPE_AS_STRING = 'prototype_as_string'
- Constant use in @MethodReflection to display prototype as a string
Methods
- __toString() : string
- getBody() : string
- Get method body
- getContents() : string
- Get method contents
- getDeclaringClass() : ClassReflection
- Get reflection of declaring class
- getDocBlock() : DocBlockReflection|false
- Retrieve method DocBlock reflection
- getParameters() : array<string|int, ParameterReflection>
- Get all method parameter reflection objects
- getPrototype() : array<string|int, mixed>|string
- Get method prototype
- getStartLine() : int
- Get start line (position) of method
- toString() : string
- extractMethodContents() : string
- Tokenize method string and return concatenated body
- extractPrefixedWhitespace() : string
- Take current position and find any whitespace
- isEndingBrace() : bool
- Test for ending brace
- isValidFunction() : bool
- Test to see if current position is valid function or closure. Returns true if it's a function and NOT a closure
Constants
PROTOTYPE_AS_ARRAY
Constant use in @MethodReflection to display prototype as an array
public
mixed
PROTOTYPE_AS_ARRAY
= 'prototype_as_array'
PROTOTYPE_AS_STRING
Constant use in @MethodReflection to display prototype as a string
public
mixed
PROTOTYPE_AS_STRING
= 'prototype_as_string'
Methods
__toString()
public
__toString() : string
Return values
stringgetBody()
Get method body
public
getBody() : string
Return values
stringgetContents()
Get method contents
public
getContents([bool $includeDocBlock = true ]) : string
Parameters
- $includeDocBlock : bool = true
Return values
stringgetDeclaringClass()
Get reflection of declaring class
public
getDeclaringClass() : ClassReflection
Return values
ClassReflectiongetDocBlock()
Retrieve method DocBlock reflection
public
getDocBlock() : DocBlockReflection|false
Return values
DocBlockReflection|falsegetParameters()
Get all method parameter reflection objects
public
getParameters() : array<string|int, ParameterReflection>
Return values
array<string|int, ParameterReflection>getPrototype()
Get method prototype
public
getPrototype([string $format = self::PROTOTYPE_AS_ARRAY ]) : array<string|int, mixed>|string
Parameters
- $format : string = self::PROTOTYPE_AS_ARRAY
Return values
array<string|int, mixed>|stringgetStartLine()
Get start line (position) of method
public
getStartLine([bool $includeDocComment = false ]) : int
Parameters
- $includeDocComment : bool = false
Return values
inttoString()
public
toString() : string
Return values
stringextractMethodContents()
Tokenize method string and return concatenated body
protected
extractMethodContents([bool $bodyOnly = false ]) : string
Parameters
- $bodyOnly : bool = false
Return values
stringextractPrefixedWhitespace()
Take current position and find any whitespace
protected
extractPrefixedWhitespace(array<string|int, mixed> $haystack, int $position) : string
Parameters
- $haystack : array<string|int, mixed>
- $position : int
Return values
stringisEndingBrace()
Test for ending brace
protected
isEndingBrace(array<string|int, mixed> $haystack, int $position) : bool
Parameters
- $haystack : array<string|int, mixed>
- $position : int
Return values
boolisValidFunction()
Test to see if current position is valid function or closure. Returns true if it's a function and NOT a closure
protected
isValidFunction(array<string|int, mixed> $haystack, int $position[, string $functionName = null ]) : bool
Parameters
- $haystack : array<string|int, mixed>
- $position : int
- $functionName : string = null