request = $request; $this->sent = $this->requestSent(); $this->form = $form; if ( $context ) { $this->context = $context; } else { $this->context = method_exists($form, 'getContext') ? $form->getContext($request) : new FormContext($request); } $this->request->context = $this->context; $this->formSent(); $this->initialize(); } public function formSent() : void { if ( false !== $this->context->formSent = $this->sent ) { if ( $this->context->formName ?? false ) { $this->sent = $this->context->formSent = (bool) ( $this->request->getParsedBody()['picea-ui-form'][$this->context->formName] ?? false ); } } } protected function initialize() : void { $this->form->initialize($this->context); if ( $this->sent ) { if ( $this->form->validate($this->context) ) { $this->executionStatus = $this->form->execute($this->context); } } } protected function requestSent() : bool { return in_array($this->request->getMethod(), [ "DELETE", "PATCH", "POST", "PUT", ]); } protected function honeyPot() : bool { $this->request->getServerParams(); } }