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->withAttribute('picea.context', $this->context); $this->initialize(); } protected function initialize() : void { $this->form->initialize($this->context); if ( $this->sent && $this->context->formSent() ) { if ( $this->validationStatus = $this->form->validate($this->context) ) { $this->context->formExecutionStatus = $this->executionStatus = $this->form->execute($this->context); $this->context->formExecuted = true; } } } protected function requestSent() : bool { return in_array(strtoupper($this->request->getMethod()), array_map('strtoupper', $this->acceptedMethods)); } protected function honeyPot() : bool { $this->request->getServerParams(); } }