Documentation

MagicClone extends MagicMethodGenerator
in package

Magic `__clone` for lazy loading ghost objects

Table of Contents

Constants

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'

Properties

$body  : string
$docBlock  : DocBlockGenerator|null
$flags  : int
$hasTentativeReturnType  : mixed
$indentation  : string
$isSourceDirty  : bool
$name  : string
$parameters  : array<string|int, ParameterGenerator>
$sourceContent  : string|null
TODO: Type should be changed to "string" in the next major version. Nullable for BC
$returnsReference  : bool
$returnType  : TypeGenerator|null

Methods

__construct()  : mixed
Constructor
__toString()  : string
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|null
getVisibility()  : mixed
isAbstract()  : bool
isFinal()  : bool
isInterface()  : bool
isSourceDirty()  : bool
isStatic()  : bool
removeDocBlock()  : void
removeFlag()  : AbstractMemberGenerator
returnsReference()  : bool
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
sortParameters()  : void
Sort parameters by their position

Constants

Properties

$hasTentativeReturnType

protected mixed $hasTentativeReturnType = false

$sourceContent

TODO: Type should be changed to "string" in the next major version. Nullable for BC

protected string|null $sourceContent = null

Methods

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
configkey

name string [required] Class Name

configkey

docblock string The DocBlock information

configkey

flags int Flags, one of self::FLAG_ABSTRACT, self::FLAG_FINAL

configkey

parameters string Class which this class is extending

configkey

body string

configkey

returntype string

configkey

returnsreference bool

configkey

abstract bool

configkey

final bool

configkey

static bool

configkey

visibility string

throws
InvalidArgumentException
Return values
MethodGenerator

getSourceContent()

public getSourceContent() : string|null
Return values
string|null

returnsReference()

public returnsReference() : bool
Return values
bool

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

sortParameters()

Sort parameters by their position

private sortParameters() : void

        
On this page

Search results