comparison vendor/symfony/serializer/Encoder/JsonEncode.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
30 /** 30 /**
31 * Encodes PHP data to a JSON string. 31 * Encodes PHP data to a JSON string.
32 * 32 *
33 * {@inheritdoc} 33 * {@inheritdoc}
34 */ 34 */
35 public function encode($data, $format, array $context = array()) 35 public function encode($data, $format, array $context = [])
36 { 36 {
37 $context = $this->resolveContext($context); 37 $context = $this->resolveContext($context);
38 38
39 $encodedJson = json_encode($data, $context['json_encode_options']); 39 $encodedJson = json_encode($data, $context['json_encode_options']);
40 40
56 /** 56 /**
57 * Merge default json encode options with context. 57 * Merge default json encode options with context.
58 * 58 *
59 * @return array 59 * @return array
60 */ 60 */
61 private function resolveContext(array $context = array()) 61 private function resolveContext(array $context = [])
62 { 62 {
63 return array_merge(array('json_encode_options' => $this->options), $context); 63 return array_merge(['json_encode_options' => $this->options], $context);
64 } 64 }
65 } 65 }