SwaggerConfig   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 107
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 0
dl 0
loc 107
ccs 30
cts 30
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A setAnalyser() 0 6 1
A setAnalysis() 0 5 1
A setProcessors() 0 5 1
A setExclude() 0 5 1
A getScanOptions() 0 13 3
A getBasePath() 0 4 1
1
<?php
2
3
namespace Basster\Silex\Provider\Swagger;
4
5
class SwaggerConfig
6
{
7
    /** @var  mixed */
8
    private $analyser;
9
10
    /** @var  mixed */
11
    private $analysis;
12
13
    /** @var array */
14
    private $processors = [];
15
16
    /** @var  mixed */
17
    private $exclude;
18
19
    /** @var  string */
20
    private $basePath;
21
22
    /**
23
     * SwaggerConfig constructor.
24
     *
25
     * @param string $basePath
26
     * @param mixed  $analyser
27
     * @param mixed  $analysis
28
     * @param array  $processors
29
     * @param mixed  $exclude
30
     */
31 8
    public function __construct(
32
        $basePath,
33
        $analyser = null,
34
        $analysis = null,
35
        array $processors = [],
36
        $exclude = null
37
    ) {
38 8
        $this->analyser   = $analyser;
39 8
        $this->analysis   = $analysis;
40 8
        $this->processors = $processors;
41 8
        $this->exclude    = $exclude;
42 8
        $this->basePath   = $basePath;
43 8
    }
44
45
    /**
46
     * @param mixed $analyser
47
     *
48
     * @return $this
49
     */
50 1
    public function setAnalyser($analyser)
51
    {
52 1
        $this->analyser = $analyser;
53
54 1
        return $this;
55
    }
56
57
    /**
58
     * @param mixed $analysis
59
     *
60
     * @return $this
61
     */
62 1
    public function setAnalysis($analysis)
63
    {
64 1
        $this->analysis = $analysis;
65 1
        return $this;
66
    }
67
68
    /**
69
     * @param array $processors
70
     *
71
     * @return $this
72
     */
73 1
    public function setProcessors($processors)
74
    {
75 1
        $this->processors = $processors;
76 1
        return $this;
77
    }
78
79
    /**
80
     * @param mixed $exclude
81
     *
82
     * @return $this
83
     */
84 1
    public function setExclude($exclude)
85
    {
86 1
        $this->exclude = $exclude;
87 1
        return $this;
88
    }
89
90 5
    public function getScanOptions()
91
    {
92 5
        $scanOptions = [];
93 5
        $properties  = ['exclude', 'analyser', 'analysis', 'processors'];
94
95 5
        foreach ($properties as $property) {
96 5
            if ($this->$property) {
97 4
                $scanOptions[$property] = $this->$property;
98 4
            }
99 5
        }
100
101 5
        return $scanOptions;
102
    }
103
104
    /**
105
     * @return string
106
     */
107 1
    public function getBasePath()
108
    {
109 1
        return $this->basePath;
110
    }
111
}
112