X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fdependency-injection%2FException%2FServiceNotFoundException.php;h=9a0128c834647acd6c2615ce5396944e2e741c07;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=e65da506bb5151b77e51cd771635ad6577276895;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php b/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php index e65da506b..9a0128c83 100644 --- a/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php +++ b/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php @@ -11,26 +11,31 @@ namespace Symfony\Component\DependencyInjection\Exception; +use Psr\Container\NotFoundExceptionInterface; + /** * This exception is thrown when a non-existent service is requested. * * @author Johannes M. Schmitt */ -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); } if ($alternatives) { - if (1 == count($alternatives)) { + if (1 == \count($alternatives)) { $msg .= ' Did you mean this: "'; } else { $msg .= ' Did you mean one of these: "'; @@ -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; + } }