class JsonHelper in GraphQL 8.4
JSON decoder for GraphQL parameters.
Hierarchy
- class \Drupal\graphql\GraphQL\Utility\JsonHelper
Expanded class hierarchy of JsonHelper
1 file declares its use of JsonHelper
- QueryRouteEnhancer.php in src/
Routing/ QueryRouteEnhancer.php
File
- src/
GraphQL/ Utility/ JsonHelper.php, line 8
Namespace
Drupal\graphql\GraphQL\UtilityView source
class JsonHelper {
/**
* Decode encoded values recursively.
*
* @param array $values
* The values to decode.
*
* @return array
* The decoded values.
*/
public static function decodeParams(array $values = []) {
return array_map(function ($value) {
if (!is_string($value)) {
return $value;
}
if (($decoded = json_decode($value, TRUE)) !== NULL && $decoded != $value) {
return is_array($decoded) ? static::decodeParams($decoded) : $decoded;
}
return $value;
}, $values);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JsonHelper:: |
public static | function | Decode encoded values recursively. |