trait InterfacesPart

Interfaces part

For all models that can contain interfaces

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

$this
addInterface(PhpInterface|string $interface)

Adds an interface.

Set
getInterfaces()

Returns the interfaces

bool
hasInterfaces()

Checks whether interfaces exists

bool
hasInterface(PhpInterface|string $interface)

Checks whether an interface exists

$this
removeInterface(PhpInterface|string $interface)

Removes an interface.

$this
setInterfaces(array $interfaces)

Sets a collection of interfaces

Details

at line line 30
abstract $this addUseStatement(string $qualifiedName, null|string $alias = null)

Adds a use statement with an optional alias

Parameters

string $qualifiedName
null|string $alias

Return Value

$this

at line line 38
abstract $this removeUseStatement(string $qualifiedName)

Removes a use statement

Parameters

string $qualifiedName

Return Value

$this

at line line 45
abstract string getNamespace()

Returns the namespace

Return Value

string

at line line 56
$this addInterface(PhpInterface|string $interface)

Adds an interface.

If the interface is passed as PhpInterface object, the interface is also added as use statement.

Parameters

PhpInterface|string $interface interface or qualified name

Return Value

$this

at line line 79
Set getInterfaces()

Returns the interfaces

Return Value

Set

at line line 88
bool hasInterfaces()

Checks whether interfaces exists

Return Value

bool true if interfaces are available and false if not

at line line 98
bool hasInterface(PhpInterface|string $interface)

Checks whether an interface exists

Parameters

PhpInterface|string $interface interface name or instance

Return Value

bool

at line line 116
$this removeInterface(PhpInterface|string $interface)

Removes an interface.

If the interface is passed as PhpInterface object, the interface is also remove from the use statements.

Parameters

PhpInterface|string $interface interface or qualified name

Return Value

$this

at line line 137
$this setInterfaces(array $interfaces)

Sets a collection of interfaces

Parameters

array $interfaces

Return Value

$this