AdapterFailureException.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  12. use Symfony\Component\Finder\Adapter\AdapterInterface;
  13. /**
  14. * Base exception for all adapter failures.
  15. *
  16. * @author Jean-François Simon <contact@jfsimon.fr>
  17. *
  18. * @deprecated since 2.8, to be removed in 3.0.
  19. */
  20. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  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. }