| Total Complexity | 3 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | abstract class BaseException extends Exception |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Inicia os atributos de acordo com o código de erro |
||
| 11 | * |
||
| 12 | * @param string $code |
||
| 13 | * @return void |
||
| 14 | */ |
||
| 15 | public function initialize(string ...$params) |
||
| 16 | { |
||
| 17 | $this->setCode()->setMessage($params); |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Define qual será o número do código de retorno |
||
| 22 | * |
||
| 23 | * @param integer $code |
||
| 24 | * @return BaseException |
||
| 25 | */ |
||
| 26 | protected function setCode() : BaseException |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Define a mensagem de texto que será enviado para o cliente |
||
| 35 | * |
||
| 36 | * @param string $theme |
||
| 37 | * @param string $name |
||
| 38 | * @return BaseException |
||
| 39 | */ |
||
| 40 | protected function setMessage(array $params = []) : BaseException |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Retorna a código de erro que será enviada ao cliente. |
||
| 51 | * |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | abstract public function getErrorCode() : string; |
||
| 55 | |||
| 56 | |||
| 57 | /** |
||
| 58 | * Retorna a mensagem de erro que será enviada ao cliente. |
||
| 59 | * |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | abstract public function getErrorMessage() : string; |
||
| 63 | } |
||
| 64 |