Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / serializer / Encoder / YamlEncoder.php
index 41ac04f2091057ed19bb5250ded52e96155b1717..3ac1af679a4a1a43f97a5ea0136ad681cc96fd7a 100644 (file)
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Serializer\Encoder;
 
+use Symfony\Component\Serializer\Exception\RuntimeException;
 use Symfony\Component\Yaml\Dumper;
 use Symfony\Component\Yaml\Parser;
 
@@ -29,6 +30,10 @@ class YamlEncoder implements EncoderInterface, DecoderInterface
 
     public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = array())
     {
+        if (!class_exists(Dumper::class)) {
+            throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.');
+        }
+
         $this->dumper = $dumper ?: new Dumper();
         $this->parser = $parser ?: new Parser();
         $this->defaultContext = array_merge($this->defaultContext, $defaultContext);