Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
69 | 8 | public function toJson(): string |
|
70 | { |
||
71 | 8 | $document = []; |
|
72 | |||
73 | 8 | foreach (array_merge($this->getFields(), self::DEFAULT_FIELDS) as $field) { |
|
74 | 8 | if (!is_null($value = $this->$field)) { |
|
75 | 8 | $document[$this->toSnakeCase($field)] = $value; |
|
76 | } |
||
77 | } |
||
78 | |||
79 | 8 | return json_encode($document); |
|
80 | } |
||
81 | |||
94 |