You are here

private function JsonEncoder::getJsonDecode in Drupal 8

Instantiates a JsonDecode instance.

@internal this exists to bridge Symfony 3 to Symfony 4, and can be removed once Drupal requires Symfony 4.2 or higher.

1 call to JsonEncoder::getJsonDecode()
JsonEncoder::__construct in core/modules/serialization/src/Encoder/JsonEncoder.php

File

core/modules/serialization/src/Encoder/JsonEncoder.php, line 59

Class

JsonEncoder
Adds 'ajax to the supported content types of the JSON encoder'

Namespace

Drupal\serialization\Encoder

Code

private function getJsonDecode() {
  $reflection = new \ReflectionClass(JsonDecode::class);
  if (array_key_exists('ASSOCIATIVE', $reflection
    ->getConstants())) {
    return new JsonDecode([
      JsonDecode::ASSOCIATIVE => TRUE,
    ]);
  }
  return new JsonDecode(TRUE);
}