Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
| FinancialException | |
100.00% |
6 / 6 |
|
100.00% |
6 / 6 |
6 | |
100.00% |
1 / 1 |
| notFound | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| invalidState | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| dealWithoutAmount | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| alreadyBootstrapped | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| noDefaultRule | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| erpUnavailable | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Financial\Domain\Exceptions; |
| 6 | |
| 7 | use RuntimeException; |
| 8 | |
| 9 | class FinancialException extends RuntimeException |
| 10 | { |
| 11 | public static function notFound(string $entity = 'Registro financeiro'): self |
| 12 | { |
| 13 | return new self("{$entity} não encontrado."); |
| 14 | } |
| 15 | |
| 16 | public static function invalidState(string $detail): self |
| 17 | { |
| 18 | return new self("Operação inválida no financeiro: {$detail}"); |
| 19 | } |
| 20 | |
| 21 | public static function dealWithoutAmount(): self |
| 22 | { |
| 23 | return new self('A oportunidade não possui valor negociado para iniciar o financeiro.'); |
| 24 | } |
| 25 | |
| 26 | public static function alreadyBootstrapped(): self |
| 27 | { |
| 28 | return new self('Esta oportunidade já possui lançamentos financeiros.'); |
| 29 | } |
| 30 | |
| 31 | public static function noDefaultRule(): self |
| 32 | { |
| 33 | return new self('Nenhuma regra de comissão padrão configurada.'); |
| 34 | } |
| 35 | |
| 36 | public static function erpUnavailable(?string $detail = null): self |
| 37 | { |
| 38 | return new self($detail ?? 'Exportação ERP indisponível ou não configurada.'); |
| 39 | } |
| 40 | } |