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