protected function getSelectedChoices($choiceViews, array $values)
    {
        $selectedChoices = [];

        foreach ($choiceViews as $index => $choiceView) {
            if ($choiceView instanceof ChoiceGroupView) {
                $selectedChoices = array_merge($selectedChoices, $this->getSelectedChoices($choiceView->choices, $values));
            } elseif ($choiceView instanceof ChoiceView) {
                if (\in_array($choiceView->value, $values)) {
                    $selectedChoices[] = $choiceView;
                }
            }
        }

        return $selectedChoices;
    }
protected function getSelectedChoices($choiceViews, array $values)
    {
        $selectedChoices = [];

        foreach ($choiceViews as $index => $choiceView) {
            if ($choiceView instanceof ChoiceGroupView) {
                $selectedChoices = array_merge($selectedChoices, $this->getSelectedChoices($choiceView->choices, $values));
            } elseif ($choiceView instanceof ChoiceView) {
                if (\in_array($choiceView->value, $values)) {
                    $selectedChoices[] = $choiceView;
                }
            }
        }

        return $selectedChoices;
    }
protected function getSelectedChoices ( $ choiceViews , array $ values ) { $ selectedChoices = [ ] ; foreach ( $ choiceViews as $ index => $ choiceView ) { if ( $ choiceView instanceof ChoiceGroupView ) { $ selectedChoices = array_merge ( $ selectedChoices , $ this -> getSelectedChoices ( $ choiceView -> choices , $ values ) ) ; } elseif ( $ choiceView instanceof ChoiceView ) { if ( \ in_array ( $ choiceView -> value , $ values ) ) { $ selectedChoices [ ] = $ choiceView ; } } } return $ selectedChoices ; }
Get the selected choices.

@param ChoiceGroupView[]|ChoiceView[] $choiceViews The choice views
@param string[]                       $values      The selected values

@return ChoiceView[] The selected choices
Get the selected choices .