| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class FormulaEngineException extends Exception |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | private $formula; |
||
| 27 | |||
| 28 | public static function fromException(Throwable $previous, string $formula, string $message = null): FormulaEngineException |
||
| 29 | { |
||
| 30 | if ($message !== null) { |
||
| 31 | $message .= ': '; |
||
| 32 | } |
||
| 33 | |||
| 34 | $message .= $previous->getMessage(); |
||
| 35 | |||
| 36 | $exception = new static($message . ' : ' . $formula, 0, $previous); |
||
| 37 | $exception->formula = $formula; |
||
| 38 | |||
| 39 | return $exception; |
||
| 40 | } |
||
| 41 | |||
| 42 | public static function create(string $formula, string $message) |
||
| 43 | { |
||
| 44 | $exception = new static($message . ' : ' . $formula); |
||
| 45 | $exception->formula = $formula; |
||
| 46 | |||
| 47 | return $exception; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function getFormula(): ?string |
||
| 53 | } |
||
| 54 | } |
||
| 55 |