src/Node/ArrayNode.php 1 location
|
@@ 30-34 (lines=5) @@
|
27 |
|
public function serialize() |
28 |
|
{ |
29 |
|
$serialized = []; |
30 |
|
foreach ($this->children as $child) { |
31 |
|
if (null !== $serializedChild = $child->serialize()) { |
32 |
|
$serialized[] = $serializedChild; |
33 |
|
} |
34 |
|
} |
35 |
|
|
36 |
|
if (!$this->allowEmpty && [] === $serialized) { |
37 |
|
return null; |
src/Node/ObjectNode.php 1 location
|
@@ 35-39 (lines=5) @@
|
32 |
|
public function serialize() |
33 |
|
{ |
34 |
|
$serialized = new \stdClass(); |
35 |
|
foreach ($this->children as $name => $child) { |
36 |
|
if (null !== $serializedChild = $child->serialize()) { |
37 |
|
$serialized->$name = $serializedChild; |
38 |
|
} |
39 |
|
} |
40 |
|
|
41 |
|
if (!$this->allowEmpty && [] === (array) $serialized) { |
42 |
|
return null; |