| Total Complexity | 3 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 59 | class Optgroup extends Element implements Fillable |
||
| 60 | { |
||
| 61 | use Fill; |
||
| 62 | |||
| 63 | protected string $type = 'option'; |
||
| 64 | |||
| 65 | |||
| 66 | 8 | public function __construct(string $title, string $parentName, mixed $defaults = '') |
|
| 67 | { |
||
| 68 | 8 | parent::__construct(\uniqid('optgroup'), $title); |
|
| 69 | 8 | $this->setAttributes( |
|
| 70 | 8 | AttributeFactory::createFromArray([ |
|
| 71 | 8 | 'label' => $title |
|
| 72 | 8 | ]) |
|
| 73 | 8 | ); |
|
| 74 | 8 | $this->setName($parentName); |
|
| 75 | 8 | $this->getAttributeCollection() |
|
| 76 | 8 | ->remove('name') |
|
| 77 | 8 | ->remove('id'); |
|
| 78 | 8 | $this->setDefault($defaults); |
|
| 79 | } |
||
| 80 | |||
| 81 | |||
| 82 | 8 | protected function setDefault(mixed $value = null): static |
|
| 83 | { |
||
| 84 | 8 | $this->setDefaultValue($value); |
|
| 85 | 8 | return $this; |
|
| 86 | } |
||
| 87 | |||
| 88 | 1 | public function baseHtml(): string |
|
| 91 | } |
||
| 92 | } |
||
| 93 |