Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class CustomerFixturePool |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * @var CustomerFixture[] |
||
13 | */ |
||
14 | private $customerFixtures = []; |
||
15 | |||
16 | 5 | public function add(CustomerInterface $customer, string $key = null): void |
|
17 | { |
||
18 | 5 | if ($key === null) { |
|
19 | 3 | $this->customerFixtures[] = new CustomerFixture($customer); |
|
20 | } else { |
||
21 | 2 | $this->customerFixtures[$key] = new CustomerFixture($customer); |
|
22 | } |
||
23 | 5 | } |
|
24 | |||
25 | /** |
||
26 | * Returns customer fixture by key, or last added if key not specified |
||
27 | * |
||
28 | * @param string|null $key |
||
29 | * @return CustomerFixture |
||
30 | */ |
||
31 | 5 | public function get(string $key = null): CustomerFixture |
|
40 | } |
||
41 | |||
42 | 2 | public function rollback(): void |
|
46 | 2 | } |
|
47 | } |
||
48 |