Conditions | 4 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
72 | public static function jsonDeserialize($json) |
||
73 | { |
||
74 | $data = array_replace(array('path' => null, 'filters' => null, 'force' => false), JSON::decode($json)); |
||
75 | |||
76 | if (false == $data['path']) { |
||
77 | throw new \LogicException('The message does not contain "path" but it is required.'); |
||
78 | } |
||
79 | |||
80 | if (false == (is_null($data['filters']) || is_array($data['filters']))) { |
||
|
|||
81 | throw new \LogicException('The message filters could be either null or array.'); |
||
82 | } |
||
83 | |||
84 | return new static($data['path'], $data['filters'], $data['force']); |
||
85 | } |
||
86 | } |
||
87 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.