Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
33 | 2 | public function toJson() |
|
34 | { |
||
35 | 2 | $document = []; |
|
36 | |||
37 | 2 | foreach ($this->getFields() as $field) { |
|
38 | 2 | $value = $this->$field; |
|
39 | |||
40 | 2 | if (is_null($value)) { |
|
41 | 1 | continue; |
|
42 | } |
||
43 | |||
44 | 2 | $document[$this->toSnakeCase($field)] = $this->$field; |
|
45 | } |
||
46 | |||
47 | 2 | return json_encode($document); |
|
48 | } |
||
49 | |||
62 |