| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | class UpDownRequest |
||
| 20 | { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var array |
||
| 24 | */ |
||
| 25 | private $params = []; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * UpDownRequest constructor. |
||
| 29 | * |
||
| 30 | * @param array $params |
||
| 31 | */ |
||
| 32 | public function __construct(array $params = []) |
||
| 33 | { |
||
| 34 | |||
| 35 | if ($params) { |
||
|
|
|||
| 36 | foreach ($params as $param_name => $param_value) { |
||
| 37 | $this->addParam($param_name, $param_value); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param string $param_name |
||
| 44 | * @param AbstractObject $param_value |
||
| 45 | * |
||
| 46 | * @return UpDownRequest |
||
| 47 | */ |
||
| 48 | public function addParam(string $param_name, $param_value): UpDownRequest |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function getQuery(): string |
||
| 69 | } |
||
| 70 | |||
| 71 | } |
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.