PHP 트레잇 gossi\codegen\model\parts\TraitsPart

For all models that can have traits
저자: Thomas Gossmann
파일 보기 프로젝트 열기: gossi/php-code-generator

공개 메소드들

메소드 설명
addTrait ( PhpTrait | string $trait ) Adds a trait.
addUseStatement ( string $qualifiedName, null | string $alias = null ) Adds a use statement with an optional alias
getNamespace ( ) : string Returns the namespace
getTraits ( ) : string[] Returns a collection of traits
hasTrait ( PhpTrait | string $trait ) : boolean Checks whether a trait exists
removeTrait ( PhpTrait | string $trait ) Removes a trait.
removeUseStatement ( string $qualifiedName ) Removes a use statement
setTraits ( array $traits ) Sets a collection of traits

메소드 상세

addTrait() 공개 메소드

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

addUseStatement() 추상적인 공개 메소드

Adds a use statement with an optional alias
abstract public addUseStatement ( string $qualifiedName, null | string $alias = null )
$qualifiedName string
$alias null | string

getNamespace() 추상적인 공개 메소드

Returns the namespace
abstract public getNamespace ( ) : string
리턴 string

getTraits() 공개 메소드

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

hasTrait() 공개 메소드

Checks whether a trait exists
public hasTrait ( PhpTrait | string $trait ) : boolean
$trait gossi\codegen\model\PhpTrait | string
리턴 boolean `true` if it exists and `false` if not

removeTrait() 공개 메소드

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

removeUseStatement() 추상적인 공개 메소드

Removes a use statement
abstract public removeUseStatement ( string $qualifiedName )
$qualifiedName string

setTraits() 공개 메소드

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