| Total Complexity | 5 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | class DiException extends \Exception |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * Initializes underlying standard PHP Exception with expanded user message. |
||
| 10 | * |
||
| 11 | * @param array $data Arbitrary data used to describe the exception. |
||
| 12 | */ |
||
| 13 | public function __construct(array $data = []) { |
||
| 14 | $this->data = $data; |
||
| 15 | parent::__construct($this->buildMessage($data)); |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Returns the exception ID which could be used for an alternative, user-friendly error message. |
||
| 20 | * Exception ID is the fully qualified classname, where backslashes are replaces with dots. |
||
| 21 | * |
||
| 22 | * @return string Exception ID |
||
| 23 | */ |
||
| 24 | public function getId() : string { |
||
| 25 | return str_replace('\\', '.', get_class($this)); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** @return array arbitrary additional data for message expanding */ |
||
| 29 | public function getData() : array { |
||
| 31 | } |
||
| 32 | |||
| 33 | /** @return string default exception message */ |
||
| 34 | public function buildMessage(array $vars) { |
||
| 40 | } |
||
| 41 | |||
| 42 | /** @var array $data arbitrary additional data for message expanding */ |
||
| 43 | protected $data; |
||
| 44 | } |