Total Complexity | 7 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class OptionFixturePool |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var OptionFixture[] |
||
17 | */ |
||
18 | private $optionFixtures = []; |
||
19 | |||
20 | public function add(AttributeOption $option, string $attributecode, string $key = null): void |
||
21 | { |
||
22 | if ($key === null) { |
||
23 | $this->optionFixtures[] = new OptionFixture($option, $attributecode); |
||
24 | } else { |
||
25 | $this->optionFixtures[$key] = new OptionFixture($option, $attributecode); |
||
26 | } |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Returns option fixture by key, or last added if key not specified |
||
31 | * |
||
32 | * @param string|null $key |
||
33 | * @return OptionFixture |
||
34 | */ |
||
35 | public function get(string $key = null): OptionFixture |
||
44 | } |
||
45 | |||
46 | public function rollback(): void |
||
50 | } |
||
51 | } |
||
52 |