NotInstantiableException.php 925 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\di;
  8. use yii\base\InvalidConfigException;
  9. /**
  10. * NotInstantiableException represents an exception caused by incorrect dependency injection container
  11. * configuration or usage.
  12. *
  13. * @author Sam Mousa <sam@mousa.nl>
  14. * @since 2.0.9
  15. */
  16. class NotInstantiableException extends InvalidConfigException
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function __construct($class, $message = null, $code = 0, \Exception $previous = null)
  22. {
  23. if ($message === null) {
  24. $message = "Can not instantiate $class.";
  25. }
  26. parent::__construct($message, $code, $previous);
  27. }
  28. /**
  29. * @return string the user-friendly name of this exception
  30. */
  31. public function getName()
  32. {
  33. return 'Not instantiable';
  34. }
  35. }