AdapterFailureException.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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\Finder\Exception;
  11. use Symfony\Component\Finder\Adapter\AdapterInterface;
  12. /**
  13. * Base exception for all adapter failures.
  14. *
  15. * @author Jean-François Simon <contact@jfsimon.fr>
  16. */
  17. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  18. {
  19. /**
  20. * @var \Symfony\Component\Finder\Adapter\AdapterInterface
  21. */
  22. private $adapter;
  23. /**
  24. * @param AdapterInterface $adapter
  25. * @param string|null $message
  26. * @param \Exception|null $previous
  27. */
  28. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  29. {
  30. $this->adapter = $adapter;
  31. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function getAdapter()
  37. {
  38. return $this->adapter;
  39. }
  40. }