| Total Complexity | 6 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class SettingsSectionCollection implements SettingsSectionCollectionInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var SettingsSectionInterface[] |
||
| 12 | */ |
||
| 13 | protected array $sections = []; |
||
| 14 | |||
| 15 | public function __construct(SettingsSectionInterface ...$sections) |
||
| 16 | { |
||
| 17 | array_map([$this, 'add'], $sections); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function add(SettingsSectionInterface $section) |
||
| 21 | { |
||
| 22 | $this->sections[$section->getId()] = $section; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function get(string $section): SettingsSectionInterface |
||
| 26 | { |
||
| 27 | return $this->sections[$section]; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function remove(string $section) |
||
| 31 | { |
||
| 32 | unset($this->sections[$section]); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function has(string $section): bool |
||
| 36 | { |
||
| 37 | return isset($this->sections[$section]); |
||
| 38 | } |
||
| 39 | |||
| 40 | public function all(): array |
||
| 43 | } |
||
| 44 | } |
||
| 45 |