Fully Qualified Name: | Laminas\Code\Generator\TraitUsageInterface |
Name | Description | Defined By |
---|---|---|
addTrait() | Add trait takes an array of trait options or string as arguments. | TraitUsageInterface |
addTraitAlias() | Add a trait alias. This will be used to generate the AS portion of the use statement. | TraitUsageInterface |
addTraitOverride() | Add a trait method override. This will be used to generate the INSTEADOF portion of the use statement. | TraitUsageInterface |
addTraits() | Add multiple traits. Trait can be an array of trait names or array of trait configurations | TraitUsageInterface |
addUse() | Add a class to "use" classes | TraitUsageInterface |
getTraitAliases() | TraitUsageInterface | |
getTraitOverrides() | Return trait overrides | TraitUsageInterface |
getTraits() | Get a list of trait names | TraitUsageInterface |
getUses() | Returns the "use" classes | TraitUsageInterface |
hasTrait() | Check to see if the class has a trait defined | TraitUsageInterface |
removeTrait() | Remove a trait by its name | TraitUsageInterface |
removeTraitOverride() | Remove an override for a given trait::method | TraitUsageInterface |
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 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
Parameter Name | Type | Description |
---|---|---|
$trait | mixed | String |
Returns: self
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
Parameter Name | Type | Description |
---|---|---|
$method | mixed | String |
$alias | string | |
$visibility | null|int |
Returns:
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:
$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
Parameter Name | Type | Description |
---|---|---|
$method | mixed | |
$traitsToReplace | mixed |
Returns:
Add multiple traits. Trait can be an array of trait names or array of trait configurations
Parameter Name | Type | Description |
---|---|---|
$traits | array | Array |
Returns: self
Add a class to "use" classes
Parameter Name | Type | Description |
---|---|---|
$use | string | |
$useAlias | string|null |
Returns: self
Returns: array
Return trait overrides
Returns: array
Get a list of trait names
Returns: array
Returns the "use" classes
Returns: array
Check to see if the class has a trait defined
Parameter Name | Type | Description |
---|---|---|
$traitName | string |
Returns: bool
Remove a trait by its name
Parameter Name | Type | Description |
---|---|---|
$traitName | string |
Returns:
Remove an override for a given trait::method
$method:
This method provides 2 ways for defining the trait method.
Option 1: String Format:
$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
Parameter Name | Type | Description |
---|---|---|
$method | mixed | |
$overridesToRemove | mixed |
Returns: self