PHP Interface gossi\codegen\model\TraitsInterface

Author: Thomas Gossmann
Datei anzeigen Open project: gossi/php-code-generator Interface Usage Examples

Public Methods

Method Description
addTrait ( PhpTrait | string $trait ) Adds a trait.
getTraits ( ) : string[] Returns a collection of traits
hasTrait ( PhpTrait | string $trait ) : boolean Checks whether a trait exists
removeTrait ( PhpTrait | string $trait ) Removes a trait.
setTraits ( array $traits ) Sets a collection of traits

Method Details

addTrait() public method

If the trait is passed as PhpTrait object, the trait is also added as use statement.
public addTrait ( PhpTrait | string $trait )
$trait PhpTrait | string trait or qualified name

getTraits() public method

Returns a collection of traits
public getTraits ( ) : string[]
return string[]

hasTrait() public method

Checks whether a trait exists
public hasTrait ( PhpTrait | string $trait ) : boolean
$trait PhpTrait | string
return boolean `true` if it exists and `false` if not

removeTrait() public method

If the trait is passed as PhpTrait object, the trait is also removed from use statements.
public removeTrait ( PhpTrait | string $trait )
$trait PhpTrait | string trait or qualified name

setTraits() public method

Sets a collection of traits
public setTraits ( array $traits )
$traits array