request = $request; $this->flash = $flash; } /** * @inheritDoc */ public function handle() { if ( ! $this->check() ) { $this->flash->add_message( 'error', 'ajax' ); return $this->redirect( new Action_URL( $this->request->page() ) ); } return $this->next->handle(); } private function check(): bool { return $this->request->is_ajax(); } }