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 | * @throws InvalidSpecificationException |
||
21 | */ |
||
22 | public function __construct($specificationFile, array $defaults = [], $cacheDir = null, $debug = false) |
||
23 | { |
||
24 | $parser = new SpecificationParser(); |
||
25 | $this->service = $parser->parse($specificationFile, $defaults ?: [], $cacheDir, $debug); |
||
0 ignored issues
–
show
|
|||
26 | } |
||
27 | |||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | */ |
||
31 | public function getName() |
||
32 | { |
||
33 | return $this->service['name']; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function getEndpoint() |
||
40 | { |
||
41 | return $this->service['endpoint']; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public function getOperations() |
||
48 | { |
||
49 | return $this->service['operations']; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function hasOperation($name) |
||
56 | { |
||
57 | return array_key_exists($name, $this->getOperations()); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | public function getOperation($name) |
||
64 | { |
||
65 | if ($this->hasOperation($name)) { |
||
66 | return $this->getOperations()[$name]; |
||
67 | } |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | public function getShapes() |
||
74 | { |
||
75 | return $this->service['shapes']; |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function hasShape($name) |
||
82 | { |
||
83 | return array_key_exists($name, $this->getShapes()); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function getShape($name) |
||
90 | { |
||
91 | if ($this->hasShape($name)) { |
||
92 | return $this->getShapes()[$name]; |
||
93 | } |
||
94 | |||
95 | return; |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function getErrorShapes() |
||
102 | { |
||
103 | return $this->service['errorShapes']; |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function hasErrorShape($name) |
||
110 | { |
||
111 | return array_key_exists($name, $this->getErrorShapes()); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | public function getErrorShape($name) |
||
118 | { |
||
119 | if ($this->hasErrorShape($name)) { |
||
120 | return $this->getErrorShapes()[$name]; |
||
121 | } |
||
122 | |||
123 | return; |
||
124 | } |
||
125 | } |
||
126 |
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..