| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 76.47% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | abstract class Nip_Form_Renderer_Elements_Input_Group extends Nip_Form_Renderer_Elements_Input_Abstract |
||
| 11 | { |
||
| 12 | protected $_separator = '<br />'; |
||
| 13 | |||
| 14 | /** @noinspection PhpMissingParentCallCommonInspection |
||
| 15 | * @return string |
||
| 16 | */ |
||
| 17 | 5 | public function generateElement() |
|
| 18 | { |
||
| 19 | 5 | $elements = $this->getElement()->getElements(); |
|
| 20 | 5 | $returnElements = []; |
|
| 21 | 5 | $return = ''; |
|
| 22 | 5 | foreach ($elements as $element) { |
|
| 23 | 3 | $returnElements[] = $this->renderChildElement($element); |
|
| 24 | } |
||
| 25 | 5 | $return .= implode($this->getSeparator(), $returnElements); |
|
| 26 | |||
| 27 | 5 | return $return; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param AbstractInput|Checkbox $element |
||
| 32 | * @return mixed |
||
| 33 | */ |
||
| 34 | 3 | public function renderChildElement($element) |
|
| 35 | { |
||
| 36 | 3 | if ($element->getValue() == $this->getElement()->getValue()) { |
|
| 37 | $element->setChecked(true); |
||
|
|
|||
| 38 | } |
||
| 39 | |||
| 40 | 3 | return $element->render(); |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | 5 | public function getSeparator() |
|
| 47 | { |
||
| 48 | 5 | return $this->_separator; |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param $separator |
||
| 53 | * @return $this |
||
| 54 | */ |
||
| 55 | public function setSeparator($separator) |
||
| 60 | } |
||
| 61 | } |
||
| 62 |