TraitsPart
trait TraitsPart
Traits part
For all models that can have traits
Methods
$this
addUseStatement(string $qualifiedName, null|string $alias = null)
Adds a use statement with an optional alias
$this
removeUseStatement(string $qualifiedName)
Removes a use statement
string
getNamespace()
Returns the namespace
string[]
getTraits()
Returns a collection of traits
$this
$this
setTraits(array $traits)
Sets a collection of traits
Details
at line line 25
abstract $this
addUseStatement(string $qualifiedName, null|string $alias = null)
Adds a use statement with an optional alias
at line line 33
abstract $this
removeUseStatement(string $qualifiedName)
Removes a use statement
at line line 40
abstract string
getNamespace()
Returns the namespace
at line line 51
$this
addTrait(PhpTrait|string $trait)
Adds a trait.
If the trait is passed as PhpTrait object, the trait is also added as use statement.
at line line 76
string[]
getTraits()
Returns a collection of traits
at line line 86
bool
hasTrait(PhpTrait|string $trait)
Checks whether a trait exists
at line line 103
$this
removeTrait(PhpTrait|string $trait)
Removes a trait.
If the trait is passed as PhpTrait object, the trait is also removed from use statements.
at line line 129
$this
setTraits(array $traits)
Sets a collection of traits