Conditions | 5 |
Paths | 16 |
Total Lines | 8 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
33 | 1 | public function build(&$parent = null) |
|
34 | { |
||
35 | 1 | $built = is_null($this->value) ? null : $this->value->build(); |
|
36 | 1 | $stringKey = is_string($built) && Regex::isProperlyQuoted($built) ? trim($built, '\'" ') : $built; |
|
37 | 1 | $key = json_encode($stringKey, JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_UNESCAPED_SLASHES); |
|
38 | 1 | if (empty($key)) throw new \Exception("Cant serialize complex key: " . var_export($this->value, true)); |
|
39 | 1 | $parent->{trim($key, '\'" ')} = null; |
|
40 | 1 | return null; |
|
41 | } |
||
48 |