| Total Complexity | 7 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class OptionFixturePool |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var OptionFixture[] |
||
| 17 | */ |
||
| 18 | private $optionFixtures = []; |
||
| 19 | |||
| 20 | 5 | public function add(AttributeOption $option, string $attributecode, string $key = null): void |
|
| 21 | { |
||
| 22 | 5 | if ($key === null) { |
|
| 23 | 3 | $this->optionFixtures[] = new OptionFixture($option, $attributecode); |
|
| 24 | } else { |
||
| 25 | 2 | $this->optionFixtures[$key] = new OptionFixture($option, $attributecode); |
|
| 26 | } |
||
| 27 | 5 | } |
|
| 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 | 5 | public function get(string $key = null): OptionFixture |
|
| 44 | } |
||
| 45 | |||
| 46 | 2 | public function rollback(): void |
|
| 50 | 2 | } |
|
| 51 | } |
||
| 52 |