MagicGet
extends MagicMethodGenerator
in package
Magic `__get` for method interceptor value holder objects
Table of Contents
- FLAG_ABSTRACT = 0x1
- FLAG_FINAL = 0x2
- FLAG_INTERFACE = 0x8
- FLAG_PRIVATE = 0x40
- FLAG_PROTECTED = 0x20
- FLAG_PUBLIC = 0x10
- FLAG_STATIC = 0x4
- LINE_FEED = "\n"
- Line feed to use in place of EOL
- VISIBILITY_PRIVATE = 'private'
- VISIBILITY_PROTECTED = 'protected'
- VISIBILITY_PUBLIC = 'public'
- $body : string
- $docBlock : DocBlockGenerator|null
- $flags : int
- $indentation : int|string
- $isSourceDirty : bool
- $name : string
- $parameters : array<string|int, ParameterGenerator>
- $sourceContent : string
- $returnsReference : bool
- $returnType : null|TypeGenerator
- __construct() : mixed
- Constructor
- __toString() : mixed
- addFlag() : AbstractMemberGenerator
- copyMethodSignature() : MethodGenerator
- Returns a MethodGenerator based on a MethodReflection with only the signature copied.
- fromArray() : MethodGenerator
- Generate from array
- fromReflection() : MethodGenerator
- fromReflectionWithoutBodyAndDocBlock() : static
- generate() : string
- getBody() : string
- getDocBlock() : DocBlockGenerator|null
- getIndentation() : string
- getName() : string
- getParameters() : array<string|int, ParameterGenerator>
- getReturnType() : TypeGenerator|null
- getSourceContent() : string
- getVisibility() : string
- isAbstract() : bool
- isFinal() : bool
- isInterface() : bool
- isSourceDirty() : bool
- isStatic() : bool
- removeDocBlock() : void
- removeFlag() : AbstractMemberGenerator
- setAbstract() : AbstractMemberGenerator
- setBody() : MethodGenerator
- setDocBlock() : AbstractMemberGenerator
- setFinal() : AbstractMemberGenerator
- setFlags() : AbstractMemberGenerator
- setIndentation() : AbstractGenerator
- setInterface() : AbstractMemberGenerator
- setName() : AbstractMemberGenerator
- setOptions() : AbstractGenerator
- setParameter() : MethodGenerator
- setParameters() : MethodGenerator
- setReturnsReference() : MethodGenerator
- setReturnType() : MethodGenerator
- setSourceContent() : AbstractGenerator
- setSourceDirty() : AbstractGenerator
- setStatic() : AbstractMemberGenerator
- setVisibility() : AbstractMemberGenerator
- clearBodyIndention() : string
- Identify the space indention from the first line and remove this indention from all lines
- expandLiteralType() : string
- extractReturnTypeFromMethodReflection() : null|string
Constants
FLAG_ABSTRACT
public
mixed
FLAG_ABSTRACT
= 0x1
FLAG_FINAL
public
mixed
FLAG_FINAL
= 0x2
FLAG_INTERFACE
public
mixed
FLAG_INTERFACE
= 0x8
FLAG_PRIVATE
public
mixed
FLAG_PRIVATE
= 0x40
FLAG_PROTECTED
public
mixed
FLAG_PROTECTED
= 0x20
FLAG_PUBLIC
public
mixed
FLAG_PUBLIC
= 0x10
FLAG_STATIC
public
mixed
FLAG_STATIC
= 0x4
LINE_FEED
Line feed to use in place of EOL
public
mixed
LINE_FEED
= "\n"
VISIBILITY_PRIVATE
public
mixed
VISIBILITY_PRIVATE
= 'private'
VISIBILITY_PROTECTED
public
mixed
VISIBILITY_PROTECTED
= 'protected'
VISIBILITY_PUBLIC
public
mixed
VISIBILITY_PUBLIC
= 'public'
Properties
$body
protected
string
$body
$docBlock
protected
DocBlockGenerator|null
$docBlock
$flags
protected
int
$flags
= self::FLAG_PUBLIC
$indentation
protected
int|string
$indentation
= ' '
4 spaces by default
$isSourceDirty
protected
bool
$isSourceDirty
= true
$name
protected
string
$name
$parameters
protected
array<string|int, ParameterGenerator>
$parameters
= []
$sourceContent
protected
string
$sourceContent
$returnsReference
private
bool
$returnsReference
= false
$returnType
private
null|TypeGenerator
$returnType
Methods
__construct()
Constructor
public
__construct(ReflectionClass $originalClass, PropertyGenerator $valueHolder, PropertyGenerator $prefixInterceptors, PropertyGenerator $suffixInterceptors, PublicPropertiesMap $publicProperties) : mixed
Parameters
- $originalClass : ReflectionClass
- $valueHolder : PropertyGenerator
- $prefixInterceptors : PropertyGenerator
- $suffixInterceptors : PropertyGenerator
- $publicProperties : PublicPropertiesMap
Tags
Return values
mixed —__toString()
public
__toString() : mixed
Return values
mixed —addFlag()
public
addFlag(int $flag) : AbstractMemberGenerator
Parameters
- $flag : int
Return values
AbstractMemberGenerator —copyMethodSignature()
Returns a MethodGenerator based on a MethodReflection with only the signature copied.
public
static copyMethodSignature(MethodReflection $reflectionMethod) : MethodGenerator
This is similar to fromReflection() but without the method body and phpdoc as this is quite heavy to copy. It's for example useful when creating proxies where you normally change the method body anyway.
Parameters
- $reflectionMethod : MethodReflection
Return values
MethodGenerator —fromArray()
Generate from array
public
static fromArray(array<string|int, mixed> $array) : MethodGenerator
Parameters
- $array : array<string|int, mixed>
Tags
Return values
MethodGenerator —fromReflection()
public
static fromReflection(MethodReflection $reflectionMethod) : MethodGenerator
Parameters
- $reflectionMethod : MethodReflection
Return values
MethodGenerator —fromReflectionWithoutBodyAndDocBlock()
public
static fromReflectionWithoutBodyAndDocBlock(MethodReflection $reflectionMethod) : static
Parameters
- $reflectionMethod : MethodReflection
Return values
static —generate()
public
generate() : string
Return values
string —getBody()
public
getBody() : string
Return values
string —getDocBlock()
public
getDocBlock() : DocBlockGenerator|null
Return values
DocBlockGenerator|null —getIndentation()
public
getIndentation() : string
Return values
string —getName()
public
getName() : string
Return values
string —getParameters()
public
getParameters() : array<string|int, ParameterGenerator>
Return values
array<string|int, ParameterGenerator> —getReturnType()
public
getReturnType() : TypeGenerator|null
Return values
TypeGenerator|null —getSourceContent()
public
getSourceContent() : string
Return values
string —getVisibility()
public
getVisibility() : string
Return values
string —isAbstract()
public
isAbstract() : bool
Return values
bool —isFinal()
public
isFinal() : bool
Return values
bool —isInterface()
public
isInterface() : bool
Return values
bool —isSourceDirty()
public
isSourceDirty() : bool
Return values
bool —isStatic()
public
isStatic() : bool
Return values
bool —removeDocBlock()
public
removeDocBlock() : void
Return values
void —removeFlag()
public
removeFlag(int $flag) : AbstractMemberGenerator
Parameters
- $flag : int
Return values
AbstractMemberGenerator —setAbstract()
public
setAbstract(bool $isAbstract) : AbstractMemberGenerator
Parameters
- $isAbstract : bool
Return values
AbstractMemberGenerator —setBody()
public
setBody(string $body) : MethodGenerator
Parameters
- $body : string
Return values
MethodGenerator —setDocBlock()
public
setDocBlock(DocBlockGenerator|string $docBlock) : AbstractMemberGenerator
Parameters
- $docBlock : DocBlockGenerator|string
Tags
Return values
AbstractMemberGenerator —setFinal()
public
setFinal(bool $isFinal) : AbstractMemberGenerator
Parameters
- $isFinal : bool
Return values
AbstractMemberGenerator —setFlags()
public
setFlags(int|array<string|int, mixed> $flags) : AbstractMemberGenerator
Parameters
- $flags : int|array<string|int, mixed>
Return values
AbstractMemberGenerator —setIndentation()
public
setIndentation(string $indentation) : AbstractGenerator
Parameters
- $indentation : string
Return values
AbstractGenerator —setInterface()
public
setInterface(bool $isInterface) : AbstractMemberGenerator
Parameters
- $isInterface : bool
Return values
AbstractMemberGenerator —setName()
public
setName(string $name) : AbstractMemberGenerator
Parameters
- $name : string
Return values
AbstractMemberGenerator —setOptions()
public
setOptions(array<string|int, mixed>|Traversable $options) : AbstractGenerator
Parameters
- $options : array<string|int, mixed>|Traversable
Tags
Return values
AbstractGenerator —setParameter()
public
setParameter(ParameterGenerator|array<string|int, mixed>|string $parameter) : MethodGenerator
Parameters
- $parameter : ParameterGenerator|array<string|int, mixed>|string
Tags
Return values
MethodGenerator —setParameters()
public
setParameters(array<string|int, mixed> $parameters) : MethodGenerator
Parameters
- $parameters : array<string|int, mixed>
Return values
MethodGenerator —setReturnsReference()
public
setReturnsReference(bool $returnsReference) : MethodGenerator
Parameters
- $returnsReference : bool
Return values
MethodGenerator —setReturnType()
public
setReturnType([string|null $returnType = null ]) : MethodGenerator
Parameters
- $returnType : string|null = null
Return values
MethodGenerator —setSourceContent()
public
setSourceContent(string $sourceContent) : AbstractGenerator
Parameters
- $sourceContent : string
Return values
AbstractGenerator —setSourceDirty()
public
setSourceDirty([bool $isSourceDirty = true ]) : AbstractGenerator
Parameters
- $isSourceDirty : bool = true
Return values
AbstractGenerator —setStatic()
public
setStatic(bool $isStatic) : AbstractMemberGenerator
Parameters
- $isStatic : bool
Return values
AbstractMemberGenerator —setVisibility()
public
setVisibility(string $visibility) : AbstractMemberGenerator
Parameters
- $visibility : string
Return values
AbstractMemberGenerator —clearBodyIndention()
Identify the space indention from the first line and remove this indention from all lines
protected
static clearBodyIndention(string $body) : string
Parameters
- $body : string
Return values
string —expandLiteralType()
private
static expandLiteralType(string $literalReturnType, ReflectionMethod $methodReflection) : string
Parameters
- $literalReturnType : string
- $methodReflection : ReflectionMethod
Return values
string —extractReturnTypeFromMethodReflection()
private
static extractReturnTypeFromMethodReflection(MethodReflection $methodReflection) : null|string
Parameters
- $methodReflection : MethodReflection