| Total Complexity | 3 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | class ServiceException extends \Exception |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * Service not found message |
||
| 25 | */ |
||
| 26 | const SERVICE_NOT_FOUND = 'Service `{%1}` not found'; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Model not instance of QtModel |
||
| 30 | */ |
||
| 31 | const NOT_INSTANCE_OF_SERVICE = 'Service `{%1}` is not instance of `{%2}`'; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Undefined method |
||
| 35 | */ |
||
| 36 | const UNDEFINED_METHOD = 'The method `{%1}` is not defined'; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param string $name |
||
| 40 | * @return \Quantum\Exceptions\ServiceException |
||
| 41 | */ |
||
| 42 | public static function serviceNotFound(string $name): ServiceException |
||
| 43 | { |
||
| 44 | return new static(_message(self::SERVICE_NOT_FOUND, $name), E_ERROR); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param array $names |
||
| 49 | * @return \Quantum\Exceptions\ServiceException |
||
| 50 | */ |
||
| 51 | public static function notServiceInstance(array $names): ServiceException |
||
| 52 | { |
||
| 53 | return new static(_message(self::NOT_INSTANCE_OF_SERVICE, $names), E_ERROR); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param string $name |
||
| 58 | * @return \Quantum\Exceptions\ServiceException |
||
| 59 | */ |
||
| 60 | public static function undefinedMethod(string $name): ServiceException |
||
| 63 | } |
||
| 64 | } |
||
| 65 |