Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/serializer/Encoder/YamlEncoder.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
9 * file that was distributed with this source code. | 9 * file that was distributed with this source code. |
10 */ | 10 */ |
11 | 11 |
12 namespace Symfony\Component\Serializer\Encoder; | 12 namespace Symfony\Component\Serializer\Encoder; |
13 | 13 |
14 use Symfony\Component\Serializer\Exception\RuntimeException; | |
14 use Symfony\Component\Yaml\Dumper; | 15 use Symfony\Component\Yaml\Dumper; |
15 use Symfony\Component\Yaml\Parser; | 16 use Symfony\Component\Yaml\Parser; |
16 | 17 |
17 /** | 18 /** |
18 * Encodes YAML data. | 19 * Encodes YAML data. |
27 private $parser; | 28 private $parser; |
28 private $defaultContext = array('yaml_inline' => 0, 'yaml_indent' => 0, 'yaml_flags' => 0); | 29 private $defaultContext = array('yaml_inline' => 0, 'yaml_indent' => 0, 'yaml_flags' => 0); |
29 | 30 |
30 public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = array()) | 31 public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = array()) |
31 { | 32 { |
33 if (!class_exists(Dumper::class)) { | |
34 throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.'); | |
35 } | |
36 | |
32 $this->dumper = $dumper ?: new Dumper(); | 37 $this->dumper = $dumper ?: new Dumper(); |
33 $this->parser = $parser ?: new Parser(); | 38 $this->parser = $parser ?: new Parser(); |
34 $this->defaultContext = array_merge($this->defaultContext, $defaultContext); | 39 $this->defaultContext = array_merge($this->defaultContext, $defaultContext); |
35 } | 40 } |
36 | 41 |