You are here

public function TaskQueue::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/promises/src/TaskQueue.php \GuzzleHttp\Promise\TaskQueue::__construct()

File

vendor/guzzlehttp/promises/src/TaskQueue.php, line 18

Class

TaskQueue
A task queue that executes tasks in a FIFO order.

Namespace

GuzzleHttp\Promise

Code

public function __construct($withShutdown = true) {
  if ($withShutdown) {
    register_shutdown_function(function () {
      if ($this->enableShutdown) {

        // Only run the tasks if an E_ERROR didn't occur.
        $err = error_get_last();
        if (!$err || $err['type'] ^ E_ERROR) {
          $this
            ->run();
        }
      }
    });
  }
}