Total Complexity | 3 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 90.48% |
Changes | 0 |
1 | <?php |
||
11 | class OperationFailureFormatter implements OperationFailureFormatterInterface |
||
12 | { |
||
13 | private OperationFormatterInterface $operationFormatter; |
||
14 | |||
15 | private ExceptionFormatterInterface $exceptionFormatter; |
||
16 | |||
17 | /** |
||
18 | * Constructor. |
||
19 | * |
||
20 | * @param OperationFormatterInterface|null $operationFormatter |
||
21 | * @param ExceptionFormatterInterface|null $exceptionFormatter |
||
22 | */ |
||
23 | 4 | public function __construct( |
|
24 | OperationFormatterInterface $operationFormatter = null, |
||
25 | ExceptionFormatterInterface $exceptionFormatter = null |
||
26 | ) { |
||
27 | 4 | $this->operationFormatter = ( |
|
28 | 4 | $operationFormatter ?? new OperationFormatter() |
|
29 | ); |
||
30 | 4 | $this->exceptionFormatter = ( |
|
31 | 4 | $exceptionFormatter ?? new ExceptionFormatter() |
|
32 | ); |
||
33 | 4 | } |
|
34 | |||
35 | /** |
||
36 | * Format the operation failure into a readable string. |
||
37 | * |
||
38 | * @param OperationFailureInterface $failure |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | 3 | public function format(OperationFailureInterface $failure): string |
|
63 | ); |
||
64 | } |
||
66 |