public static function formatResultData(AjaxChoiceListFormatterInterface $formatter, ChoiceListView $choiceListView)
    {
        $result = [];

        foreach ($choiceListView->choices as $i => $choiceView) {
            if ($choiceView instanceof ChoiceGroupView) {
                $group = $formatter->formatGroupChoice($choiceView);

                foreach ($choiceView->choices as $j => $subChoiceView) {
                    $group = $formatter->addChoiceInGroup($group, $subChoiceView);
                }

                if (!$formatter->isEmptyGroup($group)) {
                    $result[] = $group;
                }
            } else {
                $result[] = $formatter->formatChoice($choiceView);
            }
        }

        return $result;
    }
public static function formatResultData(AjaxChoiceListFormatterInterface $formatter, ChoiceListView $choiceListView)
    {
        $result = [];

        foreach ($choiceListView->choices as $i => $choiceView) {
            if ($choiceView instanceof ChoiceGroupView) {
                $group = $formatter->formatGroupChoice($choiceView);

                foreach ($choiceView->choices as $j => $subChoiceView) {
                    $group = $formatter->addChoiceInGroup($group, $subChoiceView);
                }

                if (!$formatter->isEmptyGroup($group)) {
                    $result[] = $group;
                }
            } else {
                $result[] = $formatter->formatChoice($choiceView);
            }
        }

        return $result;
    }
public static function formatResultData ( AjaxChoiceListFormatterInterface $ formatter , ChoiceListView $ choiceListView ) { $ result = [ ] ; foreach ( $ choiceListView -> choices as $ i => $ choiceView ) { if ( $ choiceView instanceof ChoiceGroupView ) { $ group = $ formatter -> formatGroupChoice ( $ choiceView ) ; foreach ( $ choiceView -> choices as $ j => $ subChoiceView ) { $ group = $ formatter -> addChoiceInGroup ( $ group , $ subChoiceView ) ; } if ( ! $ formatter -> isEmptyGroup ( $ group ) ) { $ result [ ] = $ group ; } } else { $ result [ ] = $ formatter -> formatChoice ( $ choiceView ) ; } } return $ result ; }
Format the result data.

@param AjaxChoiceListFormatterInterface $formatter      The ajax formatter
@param ChoiceListView                   $choiceListView The choice list view

@return array The formatted result data
Format the result data .