\Shmock\ClassBuilderClassBuilder

Summary

Methods
Properties
Constants
create()
addDecorator()
addMethod()
setName()
setExtends()
addInterface()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

create()

create() : string

Returns

string —

the name of the class that is being created

addDecorator()

addDecorator(callable $decorator) : void

Parameters

callable $decorator

the decorator for all functions on this class

addMethod()

addMethod(string $methodName, callable $fn, string[] $typeList, string|void $accessLevel) : void

Parameters

string $methodName

the method name

callable $fn

the implementation of the method

string[] $typeList

the type hints for each argument. Use empty string for no typehint

string|void $accessLevel

the access type, defaults to public

setName()

setName( $className) : void

Parameters

$className

Throws

\Shmock\ClassBuilder\InvalidArgumentException

if the class has already been used by another class, interface or trait

setExtends()

setExtends(string $className) : void

Parameters

string $className

T

Throws

\Shmock\ClassBuilder\InvalidArgumentException

if the class to extend does not exist

addInterface()

addInterface(string $interfaceName) : void

Parameters

string $interfaceName