Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.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\DependencyInjection\Exception; | 12 namespace Symfony\Component\DependencyInjection\Exception; |
13 | 13 |
14 use Psr\Container\NotFoundExceptionInterface; | |
15 | |
14 /** | 16 /** |
15 * This exception is thrown when a non-existent service is requested. | 17 * This exception is thrown when a non-existent service is requested. |
16 * | 18 * |
17 * @author Johannes M. Schmitt <schmittjoh@gmail.com> | 19 * @author Johannes M. Schmitt <schmittjoh@gmail.com> |
18 */ | 20 */ |
19 class ServiceNotFoundException extends InvalidArgumentException | 21 class ServiceNotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface |
20 { | 22 { |
21 private $id; | 23 private $id; |
22 private $sourceId; | 24 private $sourceId; |
25 private $alternatives; | |
23 | 26 |
24 public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = array()) | 27 public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = array(), $msg = null) |
25 { | 28 { |
26 if (null === $sourceId) { | 29 if (null !== $msg) { |
30 // no-op | |
31 } elseif (null === $sourceId) { | |
27 $msg = sprintf('You have requested a non-existent service "%s".', $id); | 32 $msg = sprintf('You have requested a non-existent service "%s".', $id); |
28 } else { | 33 } else { |
29 $msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id); | 34 $msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id); |
30 } | 35 } |
31 | 36 |
40 | 45 |
41 parent::__construct($msg, 0, $previous); | 46 parent::__construct($msg, 0, $previous); |
42 | 47 |
43 $this->id = $id; | 48 $this->id = $id; |
44 $this->sourceId = $sourceId; | 49 $this->sourceId = $sourceId; |
50 $this->alternatives = $alternatives; | |
45 } | 51 } |
46 | 52 |
47 public function getId() | 53 public function getId() |
48 { | 54 { |
49 return $this->id; | 55 return $this->id; |
51 | 57 |
52 public function getSourceId() | 58 public function getSourceId() |
53 { | 59 { |
54 return $this->sourceId; | 60 return $this->sourceId; |
55 } | 61 } |
62 | |
63 public function getAlternatives() | |
64 { | |
65 return $this->alternatives; | |
66 } | |
56 } | 67 } |