mediatekformation

TraitGenerator extends ClassGenerator
in package

Table of Contents

FLAG_ABSTRACT  = 0x1
FLAG_FINAL  = 0x2
IMPLEMENTS_KEYWORD  = 'implements'
LINE_FEED  = "\n"
Line feed to use in place of EOL
OBJECT_TYPE  = 'trait'
$constants  : array<string|int, PropertyGenerator>
$containingFileGenerator  : FileGenerator
$docBlock  : DocBlockGenerator
$extendedClass  : string
$flags  : bool
$implementedInterfaces  : array<string|int, mixed>
$indentation  : int|string
$isSourceDirty  : bool
$methods  : array<string|int, MethodGenerator>
$name  : string
$namespaceName  : string
$properties  : array<string|int, PropertyGenerator>
$sourceContent  : string
$traitUsageGenerator  : TraitUsageGenerator
__construct()  : mixed
addConstant()  : self
Add Constant
addConstantFromGenerator()  : self
Add constant from PropertyGenerator
addConstants()  : self
addFlag()  : self
addMethod()  : self
Add Method from scalars
addMethodFromGenerator()  : self
Add Method from MethodGenerator
addMethods()  : self
addProperties()  : self
addProperty()  : self
Add Property from scalars
addPropertyFromGenerator()  : self
Add property from PropertyGenerator
addTrait()  : self
Add trait takes an array of trait options or string as arguments.
addTraitAlias()  : mixed
Add a trait alias. This will be used to generate the AS portion of the use statement.
addTraitOverride()  : mixed
Add a trait method override. This will be used to generate the INSTEADOF portion of the use statement.
addTraits()  : self
Add multiple traits. Trait can be an array of trait names or array of trait configurations
addUse()  : self
Add a class to "use" classes
fromArray()  : TraitGenerator
Generate from array
fromReflection()  : TraitGenerator
Build a Code Generation Php Object from a Class Reflection
generate()  : mixed
getConstant()  : PropertyGenerator|false
getConstants()  : array<string|int, PropertyGenerator>
getContainingFileGenerator()  : FileGenerator
getDocBlock()  : DocBlockGenerator
getExtendedClass()  : string
getImplementedInterfaces()  : array<string|int, mixed>
getIndentation()  : string
getMethod()  : MethodGenerator|false
getMethods()  : array<string|int, MethodGenerator>
getName()  : string
getNamespaceName()  : string
getProperties()  : array<string|int, PropertyGenerator>
getProperty()  : PropertyGenerator|false
getSourceContent()  : string
getTraitAliases()  : array<string|int, mixed>
getTraitOverrides()  : array<string|int, mixed>
Return trait overrides
getTraits()  : array<string|int, mixed>
Get a list of trait names
getUses()  : array<string|int, mixed>
Returns the "use" classes
hasConstant()  : bool
hasExtentedClass()  : bool
hasImplementedInterface()  : bool
hasMethod()  : bool
hasProperty()  : bool
hasTrait()  : bool
Check to see if the class has a trait defined
hasUse()  : bool
hasUseAlias()  : bool
isAbstract()  : bool
isFinal()  : bool
isSourceDirty()  : bool
removeConstant()  : self
removeExtentedClass()  : self
removeFlag()  : self
removeImplementedInterface()  : self
removeMethod()  : self
removeProperty()  : self
removeTrait()  : mixed
Remove a trait by its name
removeTraitOverride()  : self
Remove an override for a given trait::method
removeUse()  : self
removeUseAlias()  : self
setAbstract()  : self
setContainingFileGenerator()  : self
setDocBlock()  : self
setExtendedClass()  : self
setFinal()  : self
setFlags()  : self
setImplementedInterfaces()  : self
setIndentation()  : AbstractGenerator
setName()  : self
setNamespaceName()  : self
setOptions()  : AbstractGenerator
setSourceContent()  : AbstractGenerator
setSourceDirty()  : AbstractGenerator
generateShortOrCompleteClassname()  : string
validateConstantValue()  : void

Constants

IMPLEMENTS_KEYWORD

public mixed IMPLEMENTS_KEYWORD = 'implements'

Properties

$implementedInterfaces

protected array<string|int, mixed> $implementedInterfaces = []

Array of string names

Methods

__construct()

public __construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
$options : array<string|int, mixed> = []
Return values
mixed —

addConstant()

Add Constant

public addConstant(string $name, string|int|null|float|array<string|int, mixed> $value) : self
Parameters
$name : string

Non-empty string

$value : string|int|null|float|array<string|int, mixed>

Scalar

Tags
throws
InvalidArgumentException
Return values
self —

addConstants()

public addConstants(array<string|int, PropertyGenerator>|array<string|int, array<string|int, mixed>> $constants) : self
Parameters
$constants : array<string|int, PropertyGenerator>|array<string|int, array<string|int, mixed>>
Return values
self —

addFlag()

public addFlag(string $flag) : self
Parameters
$flag : string
Return values
self —

addMethod()

Add Method from scalars

public addMethod(string $name[, array<string|int, mixed> $parameters = [] ][, int $flags = MethodGenerator::FLAG_PUBLIC ][, string $body = null ][, string $docBlock = null ]) : self
Parameters
$name : string
$parameters : array<string|int, mixed> = []
$flags : int = MethodGenerator::FLAG_PUBLIC
$body : string = null
$docBlock : string = null
Tags
throws
InvalidArgumentException
Return values
self —

addMethods()

public addMethods(array<string|int, mixed> $methods) : self
Parameters
$methods : array<string|int, mixed>
Return values
self —

addProperties()

public addProperties(array<string|int, mixed> $properties) : self
Parameters
$properties : array<string|int, mixed>
Return values
self —

addProperty()

Add Property from scalars

public addProperty(string $name[, string|array<string|int, mixed> $defaultValue = null ][, int $flags = PropertyGenerator::FLAG_PUBLIC ]) : self
Parameters
$name : string
$defaultValue : string|array<string|int, mixed> = null
$flags : int = PropertyGenerator::FLAG_PUBLIC
Tags
throws
InvalidArgumentException
Return values
self —

addTrait()

Add trait takes an array of trait options or string as arguments.

public addTrait(mixed $trait) : self
Parameters
$trait : mixed

String | Array

Tags
inheritDoc
Return values
self —

addTraitAlias()

Add a trait alias. This will be used to generate the AS portion of the use statement.

public addTraitAlias(mixed $method, mixed $alias[, mixed $visibility = null ]) : mixed
Parameters
$method : mixed

String or Array

$alias : mixed
$visibility : mixed = null
Tags
inheritDoc
Return values
mixed —

addTraitOverride()

Add a trait method override. This will be used to generate the INSTEADOF portion of the use statement.

public addTraitOverride(mixed $method, mixed $traitsToReplace) : mixed
Parameters
$method : mixed
$traitsToReplace : mixed
Tags
inheritDoc
Return values
mixed —

addTraits()

Add multiple traits. Trait can be an array of trait names or array of trait configurations

public addTraits(array<string|int, mixed> $traits) : self
Parameters
$traits : array<string|int, mixed>

Array of string names or configurations (@see addTrait)

Tags
inheritDoc
Return values
self —

addUse()

Add a class to "use" classes

public addUse(string $use[, string|null $useAlias = null ]) : self
Parameters
$use : string
$useAlias : string|null = null
Return values
self —

fromArray()

Generate from array

public static fromArray(array<string|int, mixed> $array) : TraitGenerator
Parameters
$array : array<string|int, mixed>
Tags
configkey

name string [required] Class Name

configkey

filegenerator FileGenerator File generator that holds this class

configkey

namespacename string The namespace for this class

configkey

docblock string The docblock information

configkey

properties

configkey

methods

throws
InvalidArgumentException
Return values
TraitGenerator —

generate()

public generate() : mixed
Tags
inheritDoc
Return values
mixed —

getExtendedClass()

public getExtendedClass() : string
Return values
string —

getImplementedInterfaces()

public getImplementedInterfaces() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getNamespaceName()

public getNamespaceName() : string
Return values
string —

getSourceContent()

public getSourceContent() : string
Return values
string —

getTraitAliases()

public getTraitAliases() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed> —

getTraitOverrides()

Return trait overrides

public getTraitOverrides() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed> —

getTraits()

Get a list of trait names

public getTraits() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed> —

getUses()

Returns the "use" classes

public getUses() : array<string|int, mixed>
Return values
array<string|int, mixed> —

hasConstant()

public hasConstant(string $constantName) : bool
Parameters
$constantName : string
Return values
bool —

hasExtentedClass()

public hasExtentedClass() : bool
Return values
bool —

hasImplementedInterface()

public hasImplementedInterface(string $implementedInterface) : bool
Parameters
$implementedInterface : string
Return values
bool —

hasMethod()

public hasMethod(string $methodName) : bool
Parameters
$methodName : string
Return values
bool —

hasProperty()

public hasProperty(string $propertyName) : bool
Parameters
$propertyName : string
Return values
bool —

hasTrait()

Check to see if the class has a trait defined

public hasTrait(mixed $traitName) : bool
Parameters
$traitName : mixed
Tags
inheritDoc
Return values
bool —

hasUse()

public hasUse(string $use) : bool
Parameters
$use : string
Return values
bool —

hasUseAlias()

public hasUseAlias(string $use) : bool
Parameters
$use : string
Return values
bool —

removeConstant()

public removeConstant(string $constantName) : self
Parameters
$constantName : string
Return values
self —

removeExtentedClass()

public removeExtentedClass() : self
Return values
self —

removeFlag()

public removeFlag(string $flag) : self
Parameters
$flag : string
Return values
self —

removeImplementedInterface()

public removeImplementedInterface(string $implementedInterface) : self
Parameters
$implementedInterface : string
Return values
self —

removeMethod()

public removeMethod(string $methodName) : self
Parameters
$methodName : string
Return values
self —

removeProperty()

public removeProperty(string $propertyName) : self
Parameters
$propertyName : string
Return values
self —

removeTrait()

Remove a trait by its name

public removeTrait(mixed $traitName) : mixed
Parameters
$traitName : mixed
Tags
inheritDoc
Return values
mixed —

removeTraitOverride()

Remove an override for a given trait::method

public removeTraitOverride(mixed $method[, mixed $overridesToRemove = null ]) : self
Parameters
$method : mixed
$overridesToRemove : mixed = null
Tags
inheritDoc
Return values
self —

removeUse()

public removeUse(string $use) : self
Parameters
$use : string
Return values
self —

removeUseAlias()

public removeUseAlias(string $use) : self
Parameters
$use : string
Return values
self —

setAbstract()

public setAbstract(bool $isAbstract) : self
Parameters
$isAbstract : bool
Return values
self —

setExtendedClass()

public setExtendedClass(string $extendedClass) : self
Parameters
$extendedClass : string
Return values
self —

setFinal()

public setFinal(bool $isFinal) : self
Parameters
$isFinal : bool
Return values
self —

setFlags()

public setFlags(array<string|int, mixed>|string $flags) : self
Parameters
$flags : array<string|int, mixed>|string
Return values
self —

setImplementedInterfaces()

public setImplementedInterfaces(array<string|int, mixed> $implementedInterfaces) : self
Parameters
$implementedInterfaces : array<string|int, mixed>
Return values
self —

setName()

public setName(string $name) : self
Parameters
$name : string
Return values
self —

setNamespaceName()

public setNamespaceName(string $namespaceName) : self
Parameters
$namespaceName : string
Return values
self —

generateShortOrCompleteClassname()

private generateShortOrCompleteClassname(string $fqnClassName) : string
Parameters
$fqnClassName : string
Return values
string —

Search results