package Default

 Methods

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

addTrait(mixed $trait) : \Zend\Code\Generator\TraitUsageInterface

Array Format: key: traitName value: String

key: aliases value: array of arrays key: method value: @see addTraitAlias key: alias value: @see addTraitAlias key: visibility value: @see addTraitAlias

key: insteadof value: array of arrays key: method value: @see self::addTraitOverride key: traitToReplace value: @see self::addTraitOverride

fluent This method is part of a fluent interface and will return the same instance

Parameters

$trait

mixed

String | Array

Returns

\Zend\Code\Generator\TraitUsageInterface

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

addTraitAlias(mixed $method, string $alias, $visibility = null

$method: This method provides 2 ways for defining the trait method. Option 1: String Option 2: Array key: traitName value: name of trait key: method value: trait method

$alias: Alias is a string representing the new method name.

$visibilty: ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PRIVATE| ReflectionMethod::IS_PROTECTED

Parameters

$method

mixed

String or Array

$alias

string

$visibility

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

addTraitOverride(mixed $method, $traitsToReplace) 

$method: This method provides 2 ways for defining the trait method. Option 1: String Format: :: Option 2: Array key: traitName value: trait name key: method value: method name

$traitToReplace: The name of the trait that you wish to supersede.

This method provides 2 ways for defining the trait method. Option 1: String of trait to replace Option 2: Array of strings of traits to replace

Parameters

$method

mixed

$traitsToReplace

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

addTraits(array $traits) : \Zend\Code\Generator\TraitUsageInterface
fluent This method is part of a fluent interface and will return the same instance

Parameters

$traits

Returns

\Zend\Code\Generator\TraitUsageInterface

Add a class to "use" classes

addUse(string $use, string|null $useAlias = null) : \Zend\Code\Generator\TraitUsageInterface
fluent This method is part of a fluent interface and will return the same instance

Parameters

$use

string

$useAlias

stringnull

Returns

\Zend\Code\Generator\TraitUsageInterface

getTraitAliases()

getTraitAliases() : array

Returns

array

Return trait overrides

getTraitOverrides() : array

Returns

array

Get a list of trait names

getTraits() : array

Returns

array

Returns the "use" classes

getUses() : array

Returns

array

Check to see if the class has a trait defined

hasTrait(\Zend\Code\Generator\strint $traitName) : boolean

Parameters

$traitName

\Zend\Code\Generator\strint

Returns

boolean

Remove a trait by its name

removeTrait($traitName) 

Parameters

$traitName

Remove an override for a given trait::method

removeTraitOverride($method, null $overridesToRemove = null) : \Zend\Code\Generator\TraitUsageInterface

$method: This method provides 2 ways for defining the trait method. Option 1: String Format: :: Option 2: Array key: traitName value: trait name key: method value: method name

$overridesToRemove: The name of the trait that you wish to remove.

This method provides 2 ways for defining the trait method. Option 1: String of trait to replace Option 2: Array of strings of traits to replace

fluent This method is part of a fluent interface and will return the same instance

Parameters

$method

$overridesToRemove

null

Returns

\Zend\Code\Generator\TraitUsageInterface