public function addChoices($choices)
    {
        if (func_num_args() > 1) {
            $choices = func_get_args();
        }

        foreach ($choices as $key => $value) {
            $label = $choice = $value;

            if (is_array($choice)) {
                $label = array_values($choice)[0];
                $choice = array_keys($choice)[0];
            } else if (is_string($key)) {
                $choice = $key;
                $label = $value;
            }

            $this->addChoice($choice, $label);
        }

        return $this;
    }
public function addChoices($choices)
    {
        if (func_num_args() > 1) {
            $choices = func_get_args();
        }

        foreach ($choices as $key => $value) {
            $label = $choice = $value;

            if (is_array($choice)) {
                $label = array_values($choice)[0];
                $choice = array_keys($choice)[0];
            } else if (is_string($key)) {
                $choice = $key;
                $label = $value;
            }

            $this->addChoice($choice, $label);
        }

        return $this;
    }
public function addChoices ( $ choices ) { if ( func_num_args ( ) > 1 ) { $ choices = func_get_args ( ) ; } foreach ( $ choices as $ key => $ value ) { $ label = $ choice = $ value ; if ( is_array ( $ choice ) ) { $ label = array_values ( $ choice ) [ 0 ] ; $ choice = array_keys ( $ choice ) [ 0 ] ; } else if ( is_string ( $ key ) ) { $ choice = $ key ; $ label = $ value ; } $ this -> addChoice ( $ choice , $ label ) ; } return $ this ; }
Add multiple choices. Also accepts multiple arguments, one for each choice.
@param array $choices Can be an array of key values ['choice' => 'label']
@return $this
Add multiple choices . Also accepts multiple arguments one for each choice .