Habari\FormUI::simulate PHP Method

simulate() public method

Simulate posting data to this form
public simulate ( array $data, boolean $do_wsse_and_id = false )
$data array An associative array of data to simultae adding to the $_POST array
$do_wsse_and_id boolean Default is false. If true, add this form's id and correct WSSE values to the $_POST array
    public function simulate($data, $do_wsse_and_id = false)
    {
        if ($do_wsse_and_id) {
            $_POST['_form_id'] = $this->control_id();
            foreach (Utils::WSSE() as $key => $value) {
                $_POST[$key] = $value;
            }
        }
        /** @var FormControl $control */
        foreach ($this->controls as $control) {
            if ($value = $control->value) {
                $_POST[$control->input_name()] = $value;
            }
        }
        foreach ($data as $key => $value) {
            $_POST[$key] = $value;
        }
    }