1 | <?php |
||
17 | abstract class AbstractCoreApiClient implements LoggerAwareInterface |
||
18 | { |
||
19 | use LoggerAwareTrait; |
||
20 | |||
21 | /** |
||
22 | * @var ClientInterface The Guzzle HTTP client |
||
23 | */ |
||
24 | protected $httpClient; |
||
25 | |||
26 | /** |
||
27 | * @var Serializer The JMS Serializer instance |
||
28 | */ |
||
29 | protected $serializer; |
||
30 | |||
31 | /** |
||
32 | * ApiClient constructor. |
||
33 | * |
||
34 | * @param ClientInterface $httpClient |
||
35 | * @param Serializer $serializer |
||
36 | */ |
||
37 | 90 | public function __construct( |
|
44 | |||
45 | /** |
||
46 | * Perform the actual request in the implementation classes. |
||
47 | * |
||
48 | * @param string $method |
||
49 | * @param string $uri |
||
50 | * @param array $options |
||
51 | * |
||
52 | * @return mixed |
||
53 | */ |
||
54 | abstract protected function _doRequest($method, $uri, $options); |
||
55 | |||
56 | /** |
||
57 | * Make a request to the API and serialize the result according to our |
||
58 | * serialization strategy. |
||
59 | * |
||
60 | * @param string $method |
||
61 | * @param string $uri |
||
62 | * @param array $options |
||
63 | * @param object $serialisationClass |
||
|
|||
64 | * |
||
65 | * @return object|ResponseInterface |
||
66 | */ |
||
67 | 48 | protected function makeRequest($method, $uri, $options) |
|
90 | |||
91 | /** |
||
92 | * Deserialize a response into an instance of it's associated class. |
||
93 | * |
||
94 | * @param string $data |
||
95 | * @param string $serialisationClass |
||
96 | * |
||
97 | * @return object |
||
98 | */ |
||
99 | 12 | protected function deserialize($data, $serialisationClass) |
|
103 | |||
104 | /** |
||
105 | * Helper method to build the JSON data array for making a request |
||
106 | * with ::makeRequest(). Optional parameters with empty or null value will be |
||
107 | * omitted from the return value. |
||
108 | * |
||
109 | * Examples: |
||
110 | * |
||
111 | * $this->buildJsonParameters(['title' => 'test'], ['description' => '', 'bla' => 'test']) |
||
112 | * |
||
113 | * Would result in: |
||
114 | * |
||
115 | * [ |
||
116 | * 'title' => 'test', |
||
117 | * 'bla' => 'test', |
||
118 | * ] |
||
119 | * |
||
120 | * @param array $required |
||
121 | * @param array $optional |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | 48 | protected function buildJsonParameters(array $required, array $optional) |
|
143 | } |
||
144 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.