Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
17 / 17 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
| GeneratorContainers | |
100.00% |
17 / 17 |
|
100.00% |
6 / 6 |
8 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| getServices | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getStructs | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| jsonSerialize | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| initStructs | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| initServices | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace WsdlToPhp\PackageGenerator\Generator; |
| 6 | |
| 7 | use WsdlToPhp\PackageGenerator\Container\Model\Service as ServiceContainer; |
| 8 | use WsdlToPhp\PackageGenerator\Container\Model\Struct as StructContainer; |
| 9 | |
| 10 | class GeneratorContainers extends AbstractGeneratorAware implements \JsonSerializable |
| 11 | { |
| 12 | protected StructContainer $structs; |
| 13 | |
| 14 | protected ServiceContainer $services; |
| 15 | |
| 16 | public function __construct(Generator $generator) |
| 17 | { |
| 18 | parent::__construct($generator); |
| 19 | $this |
| 20 | ->initStructs() |
| 21 | ->initServices() |
| 22 | ; |
| 23 | } |
| 24 | |
| 25 | public function getServices(): ServiceContainer |
| 26 | { |
| 27 | return $this->services; |
| 28 | } |
| 29 | |
| 30 | public function getStructs(): StructContainer |
| 31 | { |
| 32 | return $this->structs; |
| 33 | } |
| 34 | |
| 35 | public function jsonSerialize(): array |
| 36 | { |
| 37 | return [ |
| 38 | 'services' => $this->services, |
| 39 | 'structs' => $this->structs, |
| 40 | ]; |
| 41 | } |
| 42 | |
| 43 | protected function initStructs(): self |
| 44 | { |
| 45 | if (!isset($this->structs)) { |
| 46 | $this->structs = new StructContainer($this->generator); |
| 47 | } |
| 48 | |
| 49 | return $this; |
| 50 | } |
| 51 | |
| 52 | protected function initServices(): self |
| 53 | { |
| 54 | if (!isset($this->services)) { |
| 55 | $this->services = new ServiceContainer($this->generator); |
| 56 | } |
| 57 | |
| 58 | return $this; |
| 59 | } |
| 60 | } |