| Total Complexity | 6 | 
| Total Lines | 76 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 7 | class OptionGroup extends CompositionObject  | 
            ||
| 8 | { | 
            ||
| 9 | use OptionsTrait;  | 
            ||
| 10 | |||
| 11 | /**  | 
            ||
| 12 | * Option group label.  | 
            ||
| 13 | *  | 
            ||
| 14 | * @var \Maknz\Slack\BlockElement\Text  | 
            ||
| 15 | */  | 
            ||
| 16 | protected $label;  | 
            ||
| 17 | |||
| 18 | /**  | 
            ||
| 19 | * Internal attribute to property map.  | 
            ||
| 20 | *  | 
            ||
| 21 | * @var array  | 
            ||
| 22 | */  | 
            ||
| 23 | protected static $availableAttributes = [  | 
            ||
| 24 | 'label' => 'label',  | 
            ||
| 25 | 'options' => 'options',  | 
            ||
| 26 | ];  | 
            ||
| 27 | |||
| 28 | /**  | 
            ||
| 29 | * Get the option group label.  | 
            ||
| 30 | *  | 
            ||
| 31 | * @return \Maknz\Slack\BlockElement\Text  | 
            ||
| 32 | */  | 
            ||
| 33 | 4 | public function getLabel()  | 
            |
| 34 |     { | 
            ||
| 35 | 4 | return $this->label;  | 
            |
| 36 | }  | 
            ||
| 37 | |||
| 38 | /**  | 
            ||
| 39 | * Set the option group label.  | 
            ||
| 40 | *  | 
            ||
| 41 | * @param mixed $label  | 
            ||
| 42 | *  | 
            ||
| 43 | * @return $this  | 
            ||
| 44 | *  | 
            ||
| 45 | * @throws \InvalidArgumentException  | 
            ||
| 46 | */  | 
            ||
| 47 | 9 | public function setLabel($label)  | 
            |
| 52 | }  | 
            ||
| 53 | |||
| 54 | /**  | 
            ||
| 55 | * Get whether the option group has a selected option.  | 
            ||
| 56 | *  | 
            ||
| 57 | * @return bool  | 
            ||
| 58 | */  | 
            ||
| 59 | 6 | public function hasSelectedOption()  | 
            |
| 60 |     { | 
            ||
| 61 | 6 |         foreach ($this->getOptions() as $option) { | 
            |
| 62 | 6 |             if ($option->isInitiallySelected()) { | 
            |
| 63 | 5 | return true;  | 
            |
| 64 | }  | 
            ||
| 65 | }  | 
            ||
| 66 | |||
| 67 | 3 | return false;  | 
            |
| 68 | }  | 
            ||
| 69 | |||
| 70 | /**  | 
            ||
| 71 | * Convert the block to its array representation.  | 
            ||
| 72 | *  | 
            ||
| 73 | * @return array  | 
            ||
| 74 | */  | 
            ||
| 75 | 4 | public function toArray()  | 
            |
| 83 | }  | 
            ||
| 84 | }  | 
            ||
| 85 |