Completed
Push — master ( cdc419...060bfa )
by Mikaël
49:47
created

GeneratorContainers   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 8
lcom 1
cbo 3
dl 0
loc 67
ccs 18
cts 18
cp 1
rs 10
c 1
b 0
f 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A initStructs() 0 7 2
A initServices() 0 7 2
A getServices() 0 4 1
A getStructs() 0 4 1
A jsonSerialize() 0 7 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 828
    public function __construct(Generator $generator)
24
    {
25 828
        parent::__construct($generator);
26 828
        $this->initStructs()->initServices();
27 828
    }
28
    /**
29
     * @return GeneratorContainers
30
     */
31 828
    protected function initStructs()
32
    {
33 828
        if (!isset($this->structs)) {
34 828
            $this->structs = new StructContainer($this->generator);
35 552
        }
36 828
        return $this;
37
    }
38
    /**
39
     * @return GeneratorContainers
40
     */
41 828
    protected function initServices()
42
    {
43 828
        if (!isset($this->services)) {
44 828
            $this->services = new ServiceContainer($this->generator);
45 552
        }
46 828
        return $this;
47
    }
48
    /**
49
     * @return ServiceContainer
50
     */
51 738
    public function getServices()
52
    {
53 738
        return $this->services;
54
    }
55
    /**
56
     * @return StructContainer
57
     */
58 762
    public function getStructs()
59
    {
60 762
        return $this->structs;
61
    }
62
    /**
63
     * {@inheritDoc}
64
     * @see JsonSerializable::jsonSerialize()
65
     * @return StructContainer[]|ServiceContainer[]
66
     */
67
    public function jsonSerialize()
68
    {
69
        return array(
70
            'services' => $this->services,
71
            'structs' => $this->structs,
72
        );
73
    }
74
}
75