ResolverNotFoundException.php 892 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Exception;
  11. class ResolverNotFoundException extends \RuntimeException
  12. {
  13. /**
  14. * @param string[] $alternatives
  15. */
  16. public function __construct(string $name, array $alternatives = [])
  17. {
  18. $msg = \sprintf('You have requested a non-existent resolver "%s".', $name);
  19. if ($alternatives) {
  20. if (1 === \count($alternatives)) {
  21. $msg .= ' Did you mean this: "';
  22. } else {
  23. $msg .= ' Did you mean one of these: "';
  24. }
  25. $msg .= implode('", "', $alternatives).'"?';
  26. }
  27. parent::__construct($msg);
  28. }
  29. }