Completed
Push — develop ( af2f24...b1074b )
by Mikaël
85:27 queued 45:11
created

GeneratorContainers::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace WsdlToPhp\PackageGenerator\Generator;
4
5
use WsdlToPhp\PackageGenerator\Container\Model\Struct as StructContainer;
6
use WsdlToPhp\PackageGenerator\Container\Model\Service as ServiceContainer;
7
8
class GeneratorContainers extends AbstractGeneratorAware implements \JsonSerializable
9
{
10
    /**
11
     * Structs
12
     * @var StructContainer
13
     */
14
    private $structs;
15
    /**
16
     * Services
17
     * @var ServiceContainer
18
     */
19
    private $services;
20
    /**
21
     * @param Generator $generator
22
     */
23 695
    public function __construct(Generator $generator)
24
    {
25 695
        parent::__construct($generator);
26 695
        $this->initStructs()->initServices();
27 695
    }
28
    /**
29
     * @return GeneratorContainers
30
     */
31 695
    protected function initStructs()
32
    {
33 695
        if (!isset($this->structs)) {
34 695
            $this->structs = new StructContainer($this->generator);
35 417
        }
36 695
        return $this;
37
    }
38
    /**
39
     * @return GeneratorContainers
40
     */
41 695
    protected function initServices()
42
    {
43 695
        if (!isset($this->services)) {
44 695
            $this->services = new ServiceContainer($this->generator);
45 417
        }
46 695
        return $this;
47
    }
48
    /**
49
     * @return ServiceContainer
50
     */
51 630
    public function getServices()
52
    {
53 630
        return $this->services;
54
    }
55
    /**
56
     * @return StructContainer
57
     */
58 650
    public function getStructs()
59
    {
60 650
        return $this->structs;
61
    }
62 10
    public function jsonSerialize()
63
    {
64
        return array(
65 10
            'services' => $this->services,
66 10
            'structs' => $this->structs,
67 6
        );
68
    }
69
}
70