| Conditions | 7 |
| Paths | 18 |
| Total Lines | 30 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 15 | public function choices() |
||
| 16 | { |
||
| 17 | $choices = $this->p()->choices(); |
||
| 18 | |||
| 19 | if ($this->p()->allowNull() && !$this->p()->multiple()) { |
||
| 20 | $prepend = [ |
||
| 21 | 'value' => '', |
||
| 22 | 'label' => $this->placeholder(), |
||
| 23 | 'title' => $this->placeholder(), |
||
| 24 | 'subtext' => '' |
||
| 25 | ]; |
||
| 26 | |||
| 27 | yield $prepend; |
||
| 28 | } |
||
| 29 | |||
| 30 | foreach ($choices as $choiceIdent => $choice) { |
||
| 31 | if (!isset($choice['value'])) { |
||
| 32 | $choice['value'] = $choiceIdent; |
||
| 33 | } |
||
| 34 | if (!isset($choice['label'])) { |
||
| 35 | $choice['label'] = ucwords(strtolower(str_replace('_', ' ', $choiceIdent))); |
||
| 36 | } |
||
| 37 | if (!isset($choice['title'])) { |
||
| 38 | $choice['title'] = $choice['label']; |
||
| 39 | } |
||
| 40 | $choice['selected'] = $this->isChoiceSelected($choiceIdent); |
||
| 41 | |||
| 42 | yield $choice; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 63 |