Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public function passes($attribute, $value) |
||
39 | { |
||
40 | try { |
||
41 | $value = json_decode($value); |
||
42 | // An exception will be thrown if parsing fails |
||
43 | $geometry = GeoJson::jsonUnserialize($value); |
||
44 | } catch (Throwable $t) { |
||
45 | $this->exception = $t; |
||
46 | return false; |
||
47 | } |
||
48 | // Check geometry type if specified |
||
49 | if (!empty($this->geometryClass)) { |
||
50 | return get_class($geometry) === $this->geometryClass; |
||
51 | } |
||
52 | return true; |
||
53 | } |
||
71 |