| Total Complexity | 8 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 4 | abstract class AbstractResourceObject |
||
| 5 | { |
||
| 6 | protected $type; |
||
| 7 | protected $id; |
||
| 8 | protected $attributes; |
||
| 9 | protected $meta; |
||
| 10 | |||
| 11 | public function __construct() |
||
| 12 | { |
||
| 13 | $this->attributes = []; |
||
| 14 | $this->meta = []; |
||
| 15 | } |
||
| 16 | |||
| 17 | public function setType($type) |
||
| 18 | { |
||
| 19 | $this->type = $type; |
||
| 20 | } |
||
| 21 | |||
| 22 | public function setId($id) |
||
| 25 | } |
||
| 26 | |||
| 27 | public function setAttribute($key, $value) |
||
| 28 | { |
||
| 29 | $this->attributes[$key] = $value; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function setMeta($key, $value) |
||
| 35 | } |
||
| 36 | |||
| 37 | public function toArray() |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
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.