MethodReflection
extends ReflectionMethod
in package
implements
ReflectionInterface
Interfaces, Classes, Traits and Enums
Table of Contents
- 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
- $annotations : AnnotationScanner
- __toString() : string
- getAnnotations() : AnnotationScanner|false
- 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
- createFileScanner() : CachingFileScanner
- Creates a new FileScanner instance.
- 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'
Properties
$annotations
protected
AnnotationScanner
$annotations
Methods
__toString()
public
__toString() : string
Return values
string —getAnnotations()
public
getAnnotations(AnnotationManager $annotationManager) : AnnotationScanner|false
Parameters
- $annotationManager : AnnotationManager
Return values
AnnotationScanner|false —getBody()
Get method body
public
getBody() : string
Return values
string —getContents()
Get method contents
public
getContents([bool $includeDocBlock = true ]) : string
Parameters
- $includeDocBlock : bool = true
Return values
string —getDeclaringClass()
Get reflection of declaring class
public
getDeclaringClass() : ClassReflection
Return values
ClassReflection —getDocBlock()
Retrieve method DocBlock reflection
public
getDocBlock() : DocBlockReflection|false
Return values
DocBlockReflection|false —getParameters()
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 = MethodReflection::PROTOTYPE_AS_ARRAY ]) : array<string|int, mixed>|string
Parameters
- $format : string = MethodReflection::PROTOTYPE_AS_ARRAY
Return values
array<string|int, mixed>|string —getStartLine()
Get start line (position) of method
public
getStartLine([bool $includeDocComment = false ]) : int
Parameters
- $includeDocComment : bool = false
Return values
int —toString()
public
toString() : string
Return values
string —createFileScanner()
Creates a new FileScanner instance.
protected
createFileScanner(string $filename) : CachingFileScanner
By having this as a separate method it allows the method to be overridden if a different FileScanner is needed.
Parameters
- $filename : string
Return values
CachingFileScanner —extractMethodContents()
Tokenize method string and return concatenated body
protected
extractMethodContents([bool $bodyOnly = false ]) : string
Parameters
- $bodyOnly : bool = false
Return values
string —extractPrefixedWhitespace()
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
string —isEndingBrace()
Test for ending brace
protected
isEndingBrace(array<string|int, mixed> $haystack, int $position) : bool
Parameters
- $haystack : array<string|int, mixed>
- $position : int
Return values
bool —isValidFunction()
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