PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / vendor_prefixed / symfony / dependency-injection / Exception / ServiceNotFoundException.php

ServiceNotFoundException.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at vendor_prefixed/symfony/dependency-injection/Exception/ServiceNotFoundException.php

59 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace YoastSEO_Vendor\Symfony\Component\DependencyInjection\Exception;
12
13 use YoastSEO_Vendor\Psr\Container\NotFoundExceptionInterface;
14 /**
15 * This exception is thrown when a non-existent service is requested.
16 *
17 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
18 */
19 class ServiceNotFoundException extends \YoastSEO_Vendor\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException implements \YoastSEO_Vendor\Psr\Container\NotFoundExceptionInterface
20 {
21 private $id;
22 private $sourceId;
23 private $alternatives;
24 public function __construct(string $id, ?string $sourceId = null, ?\Throwable $previous = null, array $alternatives = [], ?string $msg = null)
25 {
26 if (null !== $msg) {
27 // no-op
28 } elseif (null === $sourceId) {
29 $msg = \sprintf('You have requested a non-existent service "%s".', $id);
30 } else {
31 $msg = \sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id);
32 }
33 if ($alternatives) {
34 if (1 == \count($alternatives)) {
35 $msg .= ' Did you mean this: "';
36 } else {
37 $msg .= ' Did you mean one of these: "';
38 }
39 $msg .= \implode('", "', $alternatives) . '"?';
40 }
41 parent::__construct($msg, 0, $previous);
42 $this->id = $id;
43 $this->sourceId = $sourceId;
44 $this->alternatives = $alternatives;
45 }
46 public function getId()
47 {
48 return $this->id;
49 }
50 public function getSourceId()
51 {
52 return $this->sourceId;
53 }
54 public function getAlternatives()
55 {
56 return $this->alternatives;
57 }
58 }
59