protected function transformValue($value, array $configuration)
    {
        if (is_array($value) || $value instanceof \ArrayAccess) {
            $array = [];
            foreach ($value as $key => $element) {
                if (isset($configuration['_descendAll']) && is_array($configuration['_descendAll'])) {
                    $array[$key] = $this->transformValue($element, $configuration['_descendAll']);
                } else {
                    if (isset($configuration['_only']) && is_array($configuration['_only']) && !in_array($key, $configuration['_only'])) {
                        continue;
                    }
                    if (isset($configuration['_exclude']) && is_array($configuration['_exclude']) && in_array($key, $configuration['_exclude'])) {
                        continue;
                    }
                    $array[$key] = $this->transformValue($element, isset($configuration[$key]) ? $configuration[$key] : []);
                }
            }
            return $array;
        } elseif (is_object($value) && $value instanceof \JsonSerializable) {
            return $this->transformValue($value->jsonSerialize(), $configuration);
        } elseif (is_object($value)) {
            return $this->transformObject($value, $configuration);
        } else {
            return $value;
        }
    }
protected function transformValue($value, array $configuration)
    {
        if (is_array($value) || $value instanceof \ArrayAccess) {
            $array = [];
            foreach ($value as $key => $element) {
                if (isset($configuration['_descendAll']) && is_array($configuration['_descendAll'])) {
                    $array[$key] = $this->transformValue($element, $configuration['_descendAll']);
                } else {
                    if (isset($configuration['_only']) && is_array($configuration['_only']) && !in_array($key, $configuration['_only'])) {
                        continue;
                    }
                    if (isset($configuration['_exclude']) && is_array($configuration['_exclude']) && in_array($key, $configuration['_exclude'])) {
                        continue;
                    }
                    $array[$key] = $this->transformValue($element, isset($configuration[$key]) ? $configuration[$key] : []);
                }
            }
            return $array;
        } elseif (is_object($value) && $value instanceof \JsonSerializable) {
            return $this->transformValue($value->jsonSerialize(), $configuration);
        } elseif (is_object($value)) {
            return $this->transformObject($value, $configuration);
        } else {
            return $value;
        }
    }
protected function transformValue ( $ value , array $ configuration ) { if ( is_array ( $ value ) || $ value instanceof \ ArrayAccess ) { $ array = [ ] ; foreach ( $ value as $ key => $ element ) { if ( isset ( $ configuration [ '_descendAll' ] ) && is_array ( $ configuration [ '_descendAll' ] ) ) { $ array [ $ key ] = $ this -> transformValue ( $ element , $ configuration [ '_descendAll' ] ) ; } else { if ( isset ( $ configuration [ '_only' ] ) && is_array ( $ configuration [ '_only' ] ) && ! in_array ( $ key , $ configuration [ '_only' ] ) ) { continue ; } if ( isset ( $ configuration [ '_exclude' ] ) && is_array ( $ configuration [ '_exclude' ] ) && in_array ( $ key , $ configuration [ '_exclude' ] ) ) { continue ; } $ array [ $ key ] = $ this -> transformValue ( $ element , isset ( $ configuration [ $ key ] ) ? $ configuration [ $ key ] : [ ] ) ; } } return $ array ; } elseif ( is_object ( $ value ) && $ value instanceof \ JsonSerializable ) { return $ this -> transformValue ( $ value -> jsonSerialize ( ) , $ configuration ) ; } elseif ( is_object ( $ value ) ) { return $ this -> transformObject ( $ value , $ configuration ) ; } else { return $ value ; } }
Transforms a value depending on type recursively using the
supplied configuration.

@param mixed $value The value to transform
@param array $configuration Configuration for transforming the value
@return array The transformed value
Transforms a value depending on type recursively using the supplied configuration .