Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
restrictioninfocollection.php
1<?php
2
4
5final class RestrictionInfoCollection implements \IteratorAggregate
6{
7
9 private array $restrictionInfoCollection = [];
10
11 public function __construct(RestrictionInfo ...$restrictionInfoList)
12 {
13 foreach ($restrictionInfoList as $restrictionInfo)
14 {
15 $this->add($restrictionInfo);
16 }
17 }
18
19 public function add(RestrictionInfo $restrictionInfo): void
20 {
21 $this->restrictionInfoCollection[$restrictionInfo->getType()] = $restrictionInfo;
22 }
23
24 public function delete(string $restrictionType): void
25 {
26 unset($this->restrictionInfoCollection[$restrictionType]);
27 }
28
29 public function get(string $restrictionType): ?RestrictionInfo
30 {
31 return $this->restrictionInfoCollection[$restrictionType] ?? null;
32 }
33
34 public function getIterator(): \ArrayIterator
35 {
36 return (new \ArrayIterator($this->restrictionInfoCollection));
37 }
38}
__construct(RestrictionInfo ... $restrictionInfoList)