errors[] = $error_string; $this->success = false; } public function success(): bool { return $this->success; } public function html_error_list(): string { if ($this->success) return ""; if (count($this->errors) > 1) { $result = ''; return $result; } else { return $this->errors[0]; } } public function on_success(Closure $param) { if ($this->success()) { $param(); } else { echo '

Please check the following problems:

'; trigger_error($this->html_error_list()); } } }