/** * Simply delegates to send() if config option "sendOnShutdown" is disabled * or enqueues the request by registering a PHP shutdown function. */ public function fire() { if ($this->config->getSendOnShutdown()) { // This dumb variable assignment is needed as PHP prohibits using // $this in closure use statements $instance = $this; // We use a closure here to retain the current values/states of // this instance and $request (as the use statement will copy them // into its own scope) register_shutdown_function(function () use($instance) { $instance->_send(); }); } else { $this->_send(); } }