| Total Complexity | 13 |
| Total Lines | 80 |
| Duplicated Lines | 0 % |
| Coverage | 92.86% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class GroupRef extends Group implements InterfaceSetMinMax |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var Group |
||
| 13 | */ |
||
| 14 | protected $wrapped; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | protected $min = 1; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var int |
||
| 23 | */ |
||
| 24 | protected $max = 1; |
||
| 25 | |||
| 26 | 74 | public function __construct(Group $group) |
|
| 30 | 74 | } |
|
| 31 | |||
| 32 | 74 | public function getMin(): int |
|
| 33 | { |
||
| 34 | 74 | return $this->min; |
|
| 35 | } |
||
| 36 | |||
| 37 | 74 | public function setMin(int $min): void |
|
| 40 | 74 | } |
|
| 41 | |||
| 42 | 74 | public function getMax(): int |
|
| 45 | } |
||
| 46 | |||
| 47 | 74 | public function setMax(int $max): void |
|
| 50 | 74 | } |
|
| 51 | |||
| 52 | 9 | public function getName(): string |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @return ElementItem[] |
||
| 59 | */ |
||
| 60 | 8 | public function getElements(): array |
|
| 61 | { |
||
| 62 | 8 | $elements = $this->wrapped->getElements(); |
|
| 63 | |||
| 64 | /** |
||
| 65 | * @var int $k |
||
| 66 | */ |
||
| 67 | 8 | foreach ($elements as $k => $element) { |
|
| 68 | /** |
||
| 69 | * @var Element|ElementRef|ElementSingle|GroupRef $e |
||
| 70 | */ |
||
| 71 | 8 | $e = clone $element; |
|
| 72 | 8 | if ($this->getMax() > 0 || $this->getMax() === -1) { |
|
| 73 | 8 | $e->setMax($this->getMax()); |
|
| 74 | } |
||
| 75 | |||
| 76 | 8 | if ($this->getMin() > 1 && $e->getMin() === 1) { |
|
| 77 | 2 | $e->setMin($this->getMin()); |
|
| 78 | } |
||
| 79 | |||
| 80 | 8 | $elements[$k] = $e; |
|
| 81 | } |
||
| 82 | |||
| 83 | 8 | return $elements; |
|
| 84 | } |
||
| 85 | |||
| 86 | public function addElement(ElementItem $element): void |
||
| 89 | } |
||
| 90 | } |
||
| 91 |