public function shutDown(callable $shutdownTask = null)
    {
        $taskReturnValue = null;

        // Don't shut down a shutdown application
        if ($this->isRunning) {
            try {
                $this->taskDispatcher->dispatch(TaskTypes::PRE_SHUTDOWN);
                $this->isRunning = false;

                if ($shutdownTask !== null) {
                    $taskReturnValue = $shutdownTask();
                }

                $this->taskDispatcher->dispatch(TaskTypes::POST_SHUTDOWN);
            } catch (Exception $ex) {
                $this->isRunning = false;

                throw $ex;
            }
        }

        return $taskReturnValue;
    }
public function shutDown(callable $shutdownTask = null)
    {
        $taskReturnValue = null;

        // Don't shut down a shutdown application
        if ($this->isRunning) {
            try {
                $this->taskDispatcher->dispatch(TaskTypes::PRE_SHUTDOWN);
                $this->isRunning = false;

                if ($shutdownTask !== null) {
                    $taskReturnValue = $shutdownTask();
                }

                $this->taskDispatcher->dispatch(TaskTypes::POST_SHUTDOWN);
            } catch (Exception $ex) {
                $this->isRunning = false;

                throw $ex;
            }
        }

        return $taskReturnValue;
    }
public function shutDown ( callable $ shutdownTask = null ) { $ taskReturnValue = null ; // Don't shut down a shutdown application if ( $ this -> isRunning ) { try { $ this -> taskDispatcher -> dispatch ( TaskTypes :: PRE_SHUTDOWN ) ; $ this -> isRunning = false ; if ( $ shutdownTask !== null ) { $ taskReturnValue = $ shutdownTask ( ) ; } $ this -> taskDispatcher -> dispatch ( TaskTypes :: POST_SHUTDOWN ) ; } catch ( Exception $ ex ) { $ this -> isRunning = false ; throw $ ex ; } } return $ taskReturnValue ; }
Shuts down this application

@param callable $shutdownTask The task to perform on shutdown
@return mixed|null The return value of the task if there was one, otherwise null
@throws Exception Thrown if there was an error shutting down the application
@deprecated 1.1.0 This method will be removed
Shuts down this application