1 | <?php |
||
8 | abstract class Request implements RequestInterface |
||
9 | { |
||
10 | /* |
||
11 | * Both $data and $options are only used in some requests, but we include them here to avoid code duplication |
||
12 | */ |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $data; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $options; |
||
22 | |||
23 | /** |
||
24 | * @return array |
||
25 | * @throws EncodeJsonException |
||
26 | */ |
||
27 | public function getBody() : array |
||
40 | |||
41 | public function getResponseClass(): string |
||
45 | |||
46 | /** |
||
47 | * @return array |
||
48 | */ |
||
49 | public function getData(): array |
||
53 | |||
54 | /** |
||
55 | * @param array $data |
||
56 | * @return Request |
||
57 | */ |
||
58 | public function setData(array $data) |
||
63 | |||
64 | public function getOption(string $option) |
||
72 | |||
73 | /** |
||
74 | * @return array |
||
75 | */ |
||
76 | public function getOptions(): array |
||
80 | |||
81 | /** |
||
82 | * @param array $options |
||
83 | * @return Request |
||
84 | */ |
||
85 | public function setOptions(array $options) |
||
90 | } |
||
91 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.