Zend Framework  3.0
Public Member Functions | List of all members
TraitUsageInterface Interface Reference

Public Member Functions

 addUse ($use, $useAlias=null)
 Add a class to "use" classes.
 
 getUses ()
 Returns the "use" classes.
 
 addTrait ($trait)
 Add trait takes an array of trait options or string as arguments.
 
 addTraits (array $traits)
 Add multiple traits.
 
 hasTrait ($traitName)
 Check to see if the class has a trait defined.
 
 getTraits ()
 Get a list of trait names.
 
 removeTrait ($traitName)
 Remove a trait by its name.
 
 addTraitAlias ($method, $alias, $visibility=null)
 Add a trait alias.
 
 getTraitAliases ()
 
 addTraitOverride ($method, $traitsToReplace)
 Add a trait method override.
 
 removeTraitOverride ($method, $overridesToRemove=null)
 Remove an override for a given trait::method.
 
 getTraitOverrides ()
 Return trait overrides.
 

Member Function Documentation

addTrait (   $trait)

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

Array Format: key: traitName value: String

key: aliases value: array of arrays key: method value:

See Also
addTraitAlias key: alias value:
addTraitAlias key: visibility value:
addTraitAlias

key: insteadof value: array of arrays key: method value:

See Also
self::addTraitOverride key: traitToReplace value:
self::addTraitOverride
Parameters
mixed$traitString | Array
Returns
self
addTraitAlias (   $method,
  $alias,
  $visibility = null 
)

Add a trait alias.

This will be used to generate the AS portion of the use statement.

$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
mixed$methodString or Array
string$alias
int$visiblity
addTraitOverride (   $method,
  $traitsToReplace 
)

Add a trait method override.

This will be used to generate the INSTEADOF portion of the use statement.

$method: This method provides 2 ways for defining the trait method. Option 1: String Format: <trait name>="">::<method name>=""> 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
mixed$method
mixed$traitToReplace
addTraits ( array  $traits)

Add multiple traits.

Trait can be an array of trait names or array of trait configurations

Parameters
array$traitNameArray of string names or configurations (
See Also
addTrait)
Returns
self
addUse (   $use,
  $useAlias = null 
)

Add a class to "use" classes.

Parameters
string$use
string | null$useAlias
Returns
self
getTraitAliases ( )
Returns
array
getTraitOverrides ( )

Return trait overrides.

Returns
array
getTraits ( )

Get a list of trait names.

Returns
array
getUses ( )

Returns the "use" classes.

Returns
array
hasTrait (   $traitName)

Check to see if the class has a trait defined.

Parameters
strint$traitName
Returns
bool
removeTrait (   $traitName)

Remove a trait by its name.

Parameters
$traitName
removeTraitOverride (   $method,
  $overridesToRemove = null 
)

Remove an override for a given trait::method.

$method: This method provides 2 ways for defining the trait method. Option 1: String Format: <trait name>="">::<method name>=""> 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

Parameters
$traitAndMethod
null$overridesToRemove
Returns
$this