/** * Extend this class to configure your own process context setup * Builds a generic processcontext with only the process data injected. * If a context was injected in the constructor, data for it is set, * but settings are not applied. */ protected function prepareProcessContext() { if (null !== $this->context) { $this->context->setData($this->data); $this->context->setProcessor($this); return; } $this->context = app($this->processContextClass, [$this->data, $this->settings, $this]); }
/** * * @param ProcessContextInterface $processContext * @param Closure $next * @return mixed */ public function handle(ProcessContextInterface $processContext, Closure $next) { $this->context = $processContext; $this->data = $this->context->getData(); $this->before(); $this->process(); $this->after(); return $next($processContext); }