Gregwar\Formidable\Form::getValues PHP Method

getValues() public method

Get all the values
public getValues ( )
    public function getValues()
    {
        $values = array();
        foreach ($this->getFields() as $field) {
            $name = $field->getBaseName();
            $index = $field->getIndex();
            if ($index === null) {
                $values[$name] = $field->getValue();
            } else {
                if (!isset($values[$name])) {
                    $values[$name] = array();
                }
                if ($index) {
                    $value =& $values[$name];
                    foreach ($index as $part) {
                        if (!isset($value[$part])) {
                            $value[$part] = array();
                        }
                        $value =& $value[$part];
                    }
                    $value = $field->getValue();
                } else {
                    $values[$name][] = $field->getValue();
                }
            }
        }
        return $values;
    }