Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
80.00% |
12 / 15 |
|
40.00% |
2 / 5 |
CRAP | |
0.00% |
0 / 1 |
| ClassSymbol | |
80.00% |
12 / 15 |
|
40.00% |
2 / 5 |
5.20 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| getExtends | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getInterfaces | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| isAbstract | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAutoloadAliasArray | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BrianHenryIE\Strauss\Types; |
| 4 | |
| 5 | use BrianHenryIE\Strauss\Files\File; |
| 6 | |
| 7 | class ClassSymbol extends DiscoveredSymbol implements AutoloadAliasInterface |
| 8 | { |
| 9 | protected ?string $extends; |
| 10 | protected bool $isAbstract; |
| 11 | protected array $interfaces; |
| 12 | |
| 13 | public function __construct( |
| 14 | string $fqdnClassname, |
| 15 | File $sourceFile, |
| 16 | bool $isAbstract = false, |
| 17 | string $namespace = '\\', |
| 18 | ?string $extends = null, |
| 19 | ?array $interfaces = null |
| 20 | ) { |
| 21 | parent::__construct($fqdnClassname, $sourceFile, $namespace); |
| 22 | |
| 23 | $this->isAbstract = $isAbstract; |
| 24 | $this->extends = $extends; |
| 25 | $this->interfaces = (array) $interfaces; |
| 26 | } |
| 27 | |
| 28 | public function getExtends(): ?string |
| 29 | { |
| 30 | return $this->extends; |
| 31 | } |
| 32 | |
| 33 | public function getInterfaces(): array |
| 34 | { |
| 35 | return $this->interfaces; |
| 36 | } |
| 37 | |
| 38 | public function isAbstract(): bool |
| 39 | { |
| 40 | return $this->isAbstract; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @return array{type:string,classname:string,isabstract:bool,namespace:string,extends:string,implements:array<string>} |
| 45 | */ |
| 46 | public function getAutoloadAliasArray(): array |
| 47 | { |
| 48 | return array ( |
| 49 | 'type' => 'class', |
| 50 | 'classname' => $this->getOriginalLocalName(), |
| 51 | 'isabstract' => $this->isAbstract, |
| 52 | 'namespace' => $this->namespace, |
| 53 | 'extends' => $this->getReplacement(), |
| 54 | 'implements' => $this->interfaces, |
| 55 | ); |
| 56 | } |
| 57 | } |