Conditions | 6 |
Paths | 6 |
Total Lines | 27 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | protected function _validate() |
||
31 | { |
||
32 | if(!is_string($this->value)) { |
||
33 | return ''; |
||
34 | } |
||
35 | |||
36 | $value = trim($this->value); |
||
37 | |||
38 | if(empty($value)) { |
||
39 | return ''; |
||
40 | } |
||
41 | |||
42 | // strictly validate for objects? |
||
43 | if($this->getBoolOption('arrays') === false) |
||
44 | { |
||
45 | if(is_object(json_decode($value))) { |
||
46 | return $value; |
||
47 | } |
||
48 | } |
||
49 | else |
||
50 | { |
||
51 | if(is_array(json_decode($value, true))) { |
||
52 | return $value; |
||
53 | } |
||
54 | } |
||
55 | |||
56 | return ''; |
||
57 | } |
||
59 |