| @@ 103-118 (lines=16) @@ | ||
| 100 | return $encoder->encode($jsonData); |
|
| 101 | } |
|
| 102 | ||
| 103 | private function decode($json, $path = null) |
|
| 104 | { |
|
| 105 | $decoder = new JsonDecoder(); |
|
| 106 | ||
| 107 | try { |
|
| 108 | $jsonData = $decoder->decode($json); |
|
| 109 | } catch (DecodingFailedException $e) { |
|
| 110 | throw new InvalidConfigException(sprintf( |
|
| 111 | "The configuration%s could not be decoded:\n%s", |
|
| 112 | $path ? ' in '.$path : '', |
|
| 113 | $e->getMessage() |
|
| 114 | ), $e->getCode(), $e); |
|
| 115 | } |
|
| 116 | ||
| 117 | return $jsonData; |
|
| 118 | } |
|
| 119 | } |
|
| @@ 73-86 (lines=14) @@ | ||
| 70 | return $encoder->encode($jsonData); |
|
| 71 | } |
|
| 72 | ||
| 73 | private function decode($json, $path = null) |
|
| 74 | { |
|
| 75 | $decoder = new JsonDecoder(); |
|
| 76 | ||
| 77 | try { |
|
| 78 | return $decoder->decode($json); |
|
| 79 | } catch (DecodingFailedException $e) { |
|
| 80 | throw new InvalidConfigException(sprintf( |
|
| 81 | "The configuration%s could not be decoded:\n%s", |
|
| 82 | $path ? ' in '.$path : '', |
|
| 83 | $e->getMessage() |
|
| 84 | ), $e->getCode(), $e); |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| 88 | private function objectsToArrays($data) |
|
| 89 | { |
|