InvalidConfigurationException.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\Config\Definition\Exception;
  11. /**
  12. * A very general exception which can be thrown whenever non of the more specific
  13. * exceptions is suitable.
  14. *
  15. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  16. */
  17. class InvalidConfigurationException extends Exception
  18. {
  19. private $path;
  20. private $containsHints = false;
  21. public function setPath($path)
  22. {
  23. $this->path = $path;
  24. }
  25. public function getPath()
  26. {
  27. return $this->path;
  28. }
  29. /**
  30. * Adds extra information that is suffixed to the original exception message.
  31. */
  32. public function addHint(string $hint)
  33. {
  34. if (!$this->containsHints) {
  35. $this->message .= "\nHint: ".$hint;
  36. $this->containsHints = true;
  37. } else {
  38. $this->message .= ', '.$hint;
  39. }
  40. }
  41. }