src/Transformer/Transformer.php 1 location
|
@@ 336-345 (lines=10) @@
|
| 333 |
|
* |
| 334 |
|
* @param array $array |
| 335 |
|
*/ |
| 336 |
|
protected static function flattenObjectsWithSingleKeyScalars(array &$array) |
| 337 |
|
{ |
| 338 |
|
if (1 === \count($array) && \is_scalar(\end($array))) { |
| 339 |
|
$array = \array_pop($array); |
| 340 |
|
} |
| 341 |
|
|
| 342 |
|
if (\is_array($array)) { |
| 343 |
|
self::loopScalarValues($array, 'flattenObjectsWithSingleKeyScalars'); |
| 344 |
|
} |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
/** |
| 348 |
|
* @return \NilPortugues\Api\Mapping\Mapping[] |
src/Transformer/Helpers/RecursiveFormatterHelper.php 1 location
|
@@ 104-113 (lines=10) @@
|
| 101 |
|
* |
| 102 |
|
* @param array $array |
| 103 |
|
*/ |
| 104 |
|
public static function flattenObjectsWithSingleKeyScalars(array &$array) |
| 105 |
|
{ |
| 106 |
|
if (1 === \count($array) && \is_scalar(\end($array))) { |
| 107 |
|
$array = \array_pop($array); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
if (\is_array($array)) { |
| 111 |
|
self::loopScalarValues($array, 'flattenObjectsWithSingleKeyScalars'); |
| 112 |
|
} |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
/** |
| 116 |
|
* @param array $array |