Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
24 | 3 | public function createAccount(string $number): AccountNumber |
|
25 | { |
||
26 | 3 | $errors = []; |
|
27 | |||
28 | 3 | foreach ($this->factories as $factory) { |
|
29 | try { |
||
30 | 3 | return $factory->createAccount($number); |
|
31 | 2 | } catch (Exception $e) { |
|
32 | 2 | $errors[] = $e->getMessage(); |
|
33 | } |
||
34 | } |
||
35 | |||
36 | 1 | throw new InvalidAccountNumberException( |
|
37 | 1 | "Unable to create account for the following resons:\n" . implode("\n", $errors) |
|
38 | ); |
||
39 | } |
||
40 | } |
||
41 |