1 | <?php |
||
13 | trait InterfacesPart { |
||
14 | |||
15 | /** @var array */ |
||
16 | private $interfaces = []; |
||
17 | |||
18 | /** |
||
19 | * Adds a use statement with an optional alias |
||
20 | * |
||
21 | * @param string $qualifiedName |
||
22 | * @param null|string $alias |
||
23 | * @return $this |
||
24 | */ |
||
25 | abstract public function addUseStatement($qualifiedName, $alias = null); |
||
26 | |||
27 | /** |
||
28 | * Removes a use statement |
||
29 | * |
||
30 | * @param string $qualifiedName |
||
31 | * @return $this |
||
32 | */ |
||
33 | abstract public function removeUseStatement($qualifiedName); |
||
34 | |||
35 | /** |
||
36 | * Returns the namespace |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | abstract public function getNamespace(); |
||
41 | |||
42 | /** |
||
43 | * Adds an interface. |
||
44 | * |
||
45 | * If the interface is passed as PhpInterface object, |
||
46 | * the interface is also added as use statement. |
||
47 | * |
||
48 | * @param PhpInterface|string $interface interface or qualified name |
||
49 | * @return $this |
||
50 | */ |
||
51 | 1 | public function addInterface($interface) { |
|
70 | |||
71 | /** |
||
72 | * Returns the interfaces |
||
73 | * |
||
74 | * @return PhpInterface[] |
||
75 | */ |
||
76 | 1 | public function getInterfaces() { |
|
79 | |||
80 | /** |
||
81 | * Checks whether interfaces exists |
||
82 | * |
||
83 | * @return bool `true` if interfaces are available and `false` if not |
||
84 | */ |
||
85 | 12 | public function hasInterfaces() { |
|
88 | |||
89 | /** |
||
90 | * Checks whether an interface exists |
||
91 | * |
||
92 | * @param PhpInterface|string $interface interface name or instance |
||
93 | * @return bool |
||
94 | */ |
||
95 | 1 | public function hasInterface($interface) { |
|
102 | |||
103 | /** |
||
104 | * Removes an interface. |
||
105 | * |
||
106 | * If the interface is passed as PhpInterface object, |
||
107 | * the interface is also remove from the use statements. |
||
108 | * |
||
109 | * @param PhpInterface|string $interface interface or qualified name |
||
110 | * @return $this |
||
111 | */ |
||
112 | 1 | public function removeInterface($interface) { |
|
129 | |||
130 | /** |
||
131 | * Sets a collection of interfaces |
||
132 | * |
||
133 | * @param PhpInterface[] $interfaces |
||
134 | * @return $this |
||
135 | */ |
||
136 | 1 | public function setInterfaces(array $interfaces) { |
|
143 | } |
||
144 |