These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace IndraGunawan\RestService; |
||
4 | |||
5 | use IndraGunawan\RestService\Parser\SpecificationParser; |
||
6 | |||
7 | class Service implements ServiceInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var ServiceInterface |
||
11 | */ |
||
12 | private $service; |
||
13 | |||
14 | /** |
||
15 | * @param string $specificationFile |
||
16 | * @param array $defaults |
||
17 | * @param string $cacheDir |
||
18 | * @param bool $debug |
||
19 | */ |
||
20 | public function __construct($specificationFile, array $defaults = [], $cacheDir = null, $debug = false) |
||
21 | { |
||
22 | $parser = new SpecificationParser(); |
||
23 | $this->service = $parser->parse($specificationFile, $defaults ?: [], $cacheDir, $debug); |
||
0 ignored issues
–
show
|
|||
24 | } |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | public function getName() |
||
30 | { |
||
31 | return $this->service['name']; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | public function getEndpoint() |
||
38 | { |
||
39 | return $this->service['endpoint']; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function getOperations() |
||
46 | { |
||
47 | return $this->service['operations']; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function hasOperation($name) |
||
54 | { |
||
55 | return array_key_exists($name, $this->getOperations()); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function getOperation($name) |
||
62 | { |
||
63 | if ($this->hasOperation($name)) { |
||
64 | return $this->getOperations()[$name]; |
||
65 | } |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function getShapes() |
||
72 | { |
||
73 | return $this->service['shapes']; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function hasShape($name) |
||
80 | { |
||
81 | return array_key_exists($name, $this->getShapes()); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function getShape($name) |
||
88 | { |
||
89 | if ($this->hasShape($name)) { |
||
90 | return $this->getShapes()[$name]; |
||
91 | } |
||
92 | |||
93 | return; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | public function getErrorShapes() |
||
100 | { |
||
101 | return $this->service['errorShapes']; |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public function hasErrorShape($name) |
||
108 | { |
||
109 | return array_key_exists($name, $this->getErrorShapes()); |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | public function getErrorShape($name) |
||
116 | { |
||
117 | if ($this->hasErrorShape($name)) { |
||
118 | return $this->getErrorShapes()[$name]; |
||
119 | } |
||
120 | |||
121 | return; |
||
122 | } |
||
123 | } |
||
124 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..