route = $route; $this->hook_handler = $hook_handler; $this->updater = $updater; $this->plugin_checker = $plugin_checker; } public function run() { try { if ( $this->updater->should_plugin_be_updated() ) { $this->updater->update_plugin(); } $this->plugin_checker->check(); $response = $this->route->create_response(); } catch ( Exception $e ) { $response = $this->route->create_error_response( $e ); } if ( $response instanceof JSON_Response ) { $response->send_json(); } if ( $response instanceof Redirection_Response ) { $response->redirect(); } if ( $response instanceof View_Response ) { $this->hook_handler->register_hooks( $response ); } } }