1 | <?php |
||
7 | class PhpClass extends AbstractElement |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | const PHP_DECLARATION = 'class'; |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | const PHP_ABSTRACT_KEYWORD = 'abstract'; |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | const PHP_IMPLEMENTS_KEYWORD = 'implements'; |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | const PHP_EXTENDS_KEYWORD = 'extends'; |
||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | protected $abstract; |
||
29 | /** |
||
30 | * @var string|PhpClass |
||
31 | */ |
||
32 | protected $extends; |
||
33 | /** |
||
34 | * @var string[]|PhpClass[] |
||
35 | */ |
||
36 | protected $interfaces; |
||
37 | /** |
||
38 | * @param string $name |
||
39 | * @param bool $abstract |
||
40 | * @param string|PhpClass|null $extends |
||
41 | * @param string[]|PhpClass[] $interfaces |
||
42 | */ |
||
43 | 106 | public function __construct($name, $abstract = false, $extends = null, array $interfaces = []) |
|
51 | /** |
||
52 | * @throws \InvalidArgumentException |
||
53 | * @param bool $abstract |
||
54 | * @return PhpClass |
||
55 | */ |
||
56 | 102 | public function setAbstract($abstract): PhpClass |
|
64 | /** |
||
65 | * @return bool |
||
66 | */ |
||
67 | 42 | public function getAbstract(): bool |
|
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | 56 | protected function getPhpAbstract(): string |
|
78 | /** |
||
79 | * @throws \InvalidArgumentException |
||
80 | * @param string|PhpClass|null $extends |
||
81 | * @return PhpClass |
||
82 | */ |
||
83 | 102 | public function setExtends($extends): PhpClass |
|
91 | /** |
||
92 | * @param string|PhpClass|null $extends |
||
93 | * @return bool |
||
94 | */ |
||
95 | 102 | public static function extendsIsValid($extends): bool |
|
99 | /** |
||
100 | * @return string|PhpClass |
||
101 | */ |
||
102 | 44 | public function getExtends() |
|
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | 56 | protected function getPhpExtends(): string |
|
114 | /** |
||
115 | * @throws \InvalidArgumentException |
||
116 | * @param string[]|PhpClass[] $interfaces |
||
117 | * @return PhpClass |
||
118 | */ |
||
119 | 102 | public function setInterfaces(array $interfaces = []): PhpClass |
|
127 | /** |
||
128 | * @param string[]|PhpClass[] $interfaces |
||
129 | * @return bool |
||
130 | */ |
||
131 | 102 | public static function interfacesAreValid(array $interfaces = []): bool |
|
139 | /** |
||
140 | * @param string|PhpClass $interface |
||
141 | * @return bool |
||
142 | */ |
||
143 | 24 | public static function interfaceIsValid($interface): bool |
|
147 | /** |
||
148 | * |
||
149 | * @return string[]|PhpClass[] |
||
150 | */ |
||
151 | 58 | public function getInterfaces(): array |
|
155 | /** |
||
156 | * @return string |
||
157 | */ |
||
158 | 56 | protected function getPhpInterfaces(): string |
|
166 | /** |
||
167 | * @param string|PhpClass $interface |
||
168 | * @return string |
||
169 | */ |
||
170 | 22 | protected function getPhpInterface($interface): string |
|
174 | /** |
||
175 | * @return string |
||
176 | */ |
||
177 | 56 | public function getPhpDeclaration(): string |
|
181 | /** |
||
182 | * defines authorized children element types |
||
183 | * @return string[] |
||
184 | */ |
||
185 | 26 | public function getChildrenTypes(): array |
|
195 | /** |
||
196 | * Allows to indicate that children are contained by brackets, |
||
197 | * in the case the method returns true, getBracketBeforeChildren |
||
198 | * is called instead of getLineBeforeChildren and getBracketAfterChildren |
||
199 | * is called instead of getLineAfterChildren, but be aware that these methods |
||
200 | * call the two others |
||
201 | * @return bool |
||
202 | */ |
||
203 | 24 | public function useBracketsForChildren(): bool |
|
207 | } |
||
208 |