private function flatten(array $choices, callable $value, &$choicesByValues, &$keysByValues, &$structuredValues): void
    {
        if (null === $choicesByValues) {
            $choicesByValues = [];
            $keysByValues = [];
            $structuredValues = [];
        }

        foreach ($choices as $key => $choice) {
            if (\is_array($choice)) {
                $this->flatten($choice, $value, $choicesByValues, $keysByValues, $structuredValues[$key]);

                continue;
            }

            $choiceValue = (string) \call_user_func($value, $choice);
            $choicesByValues[$choiceValue] = $choice;
            $keysByValues[$choiceValue] = $key;
            $structuredValues[$key] = $choiceValue;
        }
    }
private function flatten(array $choices, callable $value, &$choicesByValues, &$keysByValues, &$structuredValues): void
    {
        if (null === $choicesByValues) {
            $choicesByValues = [];
            $keysByValues = [];
            $structuredValues = [];
        }

        foreach ($choices as $key => $choice) {
            if (\is_array($choice)) {
                $this->flatten($choice, $value, $choicesByValues, $keysByValues, $structuredValues[$key]);

                continue;
            }

            $choiceValue = (string) \call_user_func($value, $choice);
            $choicesByValues[$choiceValue] = $choice;
            $keysByValues[$choiceValue] = $key;
            $structuredValues[$key] = $choiceValue;
        }
    }
private function flatten ( array $ choices , callable $ value , & $ choicesByValues , & $ keysByValues , & $ structuredValues ) : void { if ( null === $ choicesByValues ) { $ choicesByValues = [ ] ; $ keysByValues = [ ] ; $ structuredValues = [ ] ; } foreach ( $ choices as $ key => $ choice ) { if ( \ is_array ( $ choice ) ) { $ this -> flatten ( $ choice , $ value , $ choicesByValues , $ keysByValues , $ structuredValues [ $ key ] ) ; continue ; } $ choiceValue = ( string ) \ call_user_func ( $ value , $ choice ) ; $ choicesByValues [ $ choiceValue ] = $ choice ; $ keysByValues [ $ choiceValue ] = $ key ; $ structuredValues [ $ key ] = $ choiceValue ; } }
Flattens an array into the given output variables.

@param array      $choices          The array to flatten
@param callable   $value            The callable for generating choice values
@param array|null $choicesByValues  The flattened choices indexed by the
corresponding values
@param array|null $keysByValues     The original keys indexed by the
corresponding values
@param array|null $structuredValues The values indexed by the original keys
Flattens an array into the given output variables .