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