Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / dependency-injection / Exception / ServiceNotFoundException.php
index e65da506bb5151b77e51cd771635ad6577276895..59567074ccb2cf99ee3106e41176a23eaf4e5d04 100644 (file)
 
 namespace Symfony\Component\DependencyInjection\Exception;
 
+use Psr\Container\NotFoundExceptionInterface;
+
 /**
  * This exception is thrown when a non-existent service is requested.
  *
  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  */
-class ServiceNotFoundException extends InvalidArgumentException
+class ServiceNotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface
 {
     private $id;
     private $sourceId;
+    private $alternatives;
 
-    public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = array())
+    public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = array(), $msg = null)
     {
-        if (null === $sourceId) {
+        if (null !== $msg) {
+            // no-op
+        } elseif (null === $sourceId) {
             $msg = sprintf('You have requested a non-existent service "%s".', $id);
         } else {
             $msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id);
@@ -42,6 +47,7 @@ class ServiceNotFoundException extends InvalidArgumentException
 
         $this->id = $id;
         $this->sourceId = $sourceId;
+        $this->alternatives = $alternatives;
     }
 
     public function getId()
@@ -53,4 +59,9 @@ class ServiceNotFoundException extends InvalidArgumentException
     {
         return $this->sourceId;
     }
+
+    public function getAlternatives()
+    {
+        return $this->alternatives;
+    }
 }