Executes all callbacks from the top of queue to bottom with arbitrary arguments
@param  mixed ...$args Arguments
@return integer
327644
public function executeAll(...$args)
    {
        if ($this->isEmpty()) {
            return 0;
        }
        $n = 0;
        do {
            $cb = $this->extract();
            if ($cb) {
                $cb(...$args);
                ++$n;
            }
        } while (!$this->isEmpty());
        return $n;
    }
827741
public function eventCall($arg)
    {
        try {
            if ($this->state === Generic::STATE_FINISHED) {
                $this->finish();
                $this->free();
                return;
            }
            $this->state = Generic::STATE_RUNNING;
            $this->onWakeup();
            $throw = false;
            try {
                $ret = $this->run();
                if (($ret === Generic::STATE_FINISHED) || ($ret === null)) {
                    $this->finish();
                } elseif ($ret === Generic::STATE_WAITING) {
                    $this->state = $ret;
                }
            } catch (RequestSleep $e) {
                $this->state = Generic::STATE_WAITING;
            } catch (RequestTerminated $e) {
                $this->state = Generic::STATE_FINISHED;
            } catch (\Exception $e) {
                if (!$this->handleException($e)) {
                    $throw = true;
                }
            }
            if ($this->state === Generic::STATE_FINISHED) {
                $this->finish();
            }
            $this->onSleep();
            if ($throw) {
                throw $e;
            }
        } catch (\Exception $e) {
            Daemon::uncaughtExceptionHandler($e);
            $this->finish();
            return;
        }
        if ($this->state === Generic::STATE_WAITING) {
            $this->ev->add($this->sleepTime);
        }
    }
937473
private static function exec(array $args)
    {
        $cmd = implode(' ', array_map('escapeshellarg', $args)) . ' 2>/dev/null';
        $process = proc_open($cmd, [1 => ['pipe', 'w']], $pipes);
        $output = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
        if (proc_close($process) !== 0) {
            return false;
        }

        return $output;
    }
1112762
protected function call($method, $args)
    {
        $method = str_replace("_", ".", $method);
        $request = new $this->requestClass($this->apiKey, $method, $args, $this->secure);
        return $request->execute();
    }
719635
private function runUpdate($args)
    {
        $cmd = new UpdateCommand($this->cwd);

        return $cmd->run(array_slice($args, 1));
    }
365672
public function run(array $args = null) {
		$exec = escapeshellcmd($this->command);
		if ($args) {
			$exec .= " ". implode(" ", array_map("escapeshellarg", (array) $args));
		}
		
		if ($this->sudo) {
			$this->suExec(sprintf($this->sudo." 2>&1", $exec), $this->verbose);
		} elseif ($this->verbose) {
			ob_start(function($s) {
				$this->output .= $s;
				return $s;
			}, 1);
			passthru($exec, $this->status);
			ob_end_flush();
		} elseif ($this->verbose !== false /* !quiet */) {
			ob_start([$this, "progress"], 1);
			passthru($exec . " 2>&1", $this->status);
			ob_end_flush();
		} else {
			exec($exec ." 2>&1", $output, $this->status);
			$this->output = implode("\n", $output);
		}
		
		if ($this->status) {
			throw new Exception("Command {$exec} failed ({$this->status})");
		}

		return $this;
	}
1017063
public function set($callback, $args = [])
    {
        if ($this->postTrigger) {
            if (isset($_POST[$this->postTrigger])) {
                $this->app->catch_runaway_callbacks = false;
                $this->triggered = $_POST[$this->postTrigger];

                $t = $this->app->run_called;
                $this->app->run_called = true;
                $ret = call_user_func_array($callback, $args);
                $this->app->run_called = $t;

                return $ret;
            }
        } else {
            if (isset($_GET[$this->urlTrigger])) {
                $this->app->catch_runaway_callbacks = false;
                $this->triggered = $_GET[$this->urlTrigger];

                $t = $this->app->run_called;
                $this->app->run_called = true;
                $this->owner->stickyGet($this->urlTrigger);
                $ret = call_user_func_array($callback, $args);
                //$this->app->stickyForget($this->name);
                $this->app->run_called = $t;

                return $ret;
            }
        }
    }
379274
public function call(): int
    {
        $count = 0;

        while (!$this->queue->isEmpty() && (0 === $this->maxDepth || $count < $this->maxDepth)) {
            list($callback, $args) = $this->queue->shift();
            ++$count;

            if (empty($args)) {
                $callback();
            } else {
                call_user_func_array($callback, $args);
            }
        }

        return $count;
    }
449744
public function execute(array $args, array $options = [])
    {
        $this->bootstrap($args, $options);

        $version = isset($options['target']) ? $options['target'] : $options['t'];
        $date = isset($options['date']) ? $options['date'] : $options['d'];
        $force = isset($options['force']) ? $options['force'] : $options['f'];

        // rollback the specified environment
        $start = microtime(true);
        if (null !== $date) {
            $this->getManager()->rollbackToDateTime(new \DateTime($date), $force);
        } else {
            $this->getManager()->rollback($version, $force);
        }
        $end = microtime(true);

        Output::writeln('');
        Output::writeln(Colour::colour('All Done. Took ', Colour::GREEN) . sprintf('%.4fs', $end - $start));
    }
818229
private function executeMethod(array $arguments)
    {
        if ($this->reflection->isStatic()) {
            return $this->reflection->invokeArgs(null, $arguments);
        } elseif (is_object($this->callback[0])) {
            return $this->reflection->invokeArgs($this->callback[0], $arguments);
        }
        $instance = new $this->callback[0]();
        return $this->reflection->invokeArgs($instance, $arguments);
    }
39688
public function executeOne(...$args)
    {
        if ($this->isEmpty()) {
            return false;
        }
        $cb = $this->shift();
        if ($cb) {
            $cb(...$args);
            if ($cb instanceof CallbackWrapper) {
                $cb->cancel();
            }
        }
        return true;
    }
651396
public function auto(Argument $args, $total, array $callableArgs = [])
    {
        $args = $this->protectArgs($args);

        if ($args['last']) {
            $connection = $this->backward($args, $total, $callableArgs);
        } else {
            $connection = $this->forward($args);
        }

        if ($this->promise) {
            return $connection->then(function (ConnectionInterface $connection) use ($total, $callableArgs) {
                $connection->setTotalCount($this->computeTotalCount($total, $callableArgs));

                return $connection;
            });
        } else {
            $connection->setTotalCount($this->computeTotalCount($total, $callableArgs));

            return $connection;
        }
    }
596315
protected function executeCallback($callback, $args)
    {
        if (is_string($callback)) {
            return $this->callStringCallback($callback, $args);
        } elseif ($callback instanceof Closure) {
            return call_user_func_array($callback, $args);
        }

        return '';
    }
850829
public static function finish(...$args)
    {
        if (Debugger::isProductionMode()) {
            return false;
        }

        if ([] === static::$stack) {
            throw new \RuntimeException('The stack is empty. Call Hail\Debugger\Profiler::start() first.');
        }

        $now = \microtime(true);
        $memoryUsage = \memory_get_usage(true);

        if (!isset($args[1])) {
            $label = $args[0] ?? static::getCurrentFileHashLine(1);
        } else {
            $label = \sprintf(...$args);
        }

        /** @var array $profile */
        $profile = \array_pop(static::$stack);
        $profile['meta'][self::FINISH_LABEL] = $label;
        $profile['meta'][self::FINISH_TIME] = $now;
        $profile['meta'][self::FINISH_MEMORY_USAGE] = $memoryUsage;
        $profile[self::ABSOLUTE_DURATION] = $profile['meta'][self::FINISH_TIME] - $profile['meta'][self::START_TIME];
        $profile[self::DURATION] = $profile[self::ABSOLUTE_DURATION] - $profile['meta'][self::TIME_OFFSET];
        $profile[self::ABSOLUTE_MEMORY_USAGE_CHANGE] = $profile['meta'][self::FINISH_MEMORY_USAGE] - $profile['meta'][self::START_MEMORY_USAGE];
        $profile[self::MEMORY_USAGE_CHANGE] = $profile[self::ABSOLUTE_MEMORY_USAGE_CHANGE] - $profile['meta'][self::MEMORY_USAGE_OFFSET];
        if ([] !== static::$stack) {
            $prefix = &static::$stack[\count(static::$stack) - 1]['meta'];
            $prefix[self::TIME_OFFSET] += $profile[self::ABSOLUTE_DURATION];
            $prefix[self::MEMORY_USAGE_OFFSET] += $profile[self::ABSOLUTE_MEMORY_USAGE_CHANGE];
        }

        self::$profiles[] = $profile;

        return $profile;
    }
1142906
public static function run($args=null){
      if (PHP_SAPI != 'cli') return false;
      if($args) {
        $_args = $args;
        static::$file = basename(isset($_SERVER['PHP_SELF'])?$_SERVER['PHP_SELF']:__FILE__);
       } else {
        $_args = $_SERVER['argv'];
        static::$file = basename(array_shift($_args));
      }
      foreach($_args as $e) if(strpos($e,'-')===0) {
        $h = explode('=',$e);
        static::$options[ltrim(current($h),'-')] = isset($h[1])?$h[1]:true;
      } else {
        static::$arguments[] = $e;
      }

      if(isset(static::$arguments[0])){
        $command = array_shift(static::$arguments);
        if (empty(static::$commands[$command]))
          return static::triggerError("Unknown command [".$command."].");
        $cmd = static::$commands[$command];
        $pars_vector = [];
        foreach ($cmd[0] as $_idx => $segment) {
          if ($segment[0]==':'){
            // Extract paramenter
            if (isset(static::$arguments[$_idx])){
               $pars_vector[] = static::$arguments[$_idx];
            } else return static::triggerError("Command [".$command."] needs more parameters");
          } else {
            // Match command
            if (empty(static::$arguments[$_idx]) || $segment!=static::$arguments[$_idx])
              return static::triggerError("Command [".$command."] is incomplete.");
          }
        }
        $returns = call_user_func_array($cmd[1], $pars_vector);
        echo is_scalar($returns) ? "$returns" : json_encode($returns, JSON_PRETTY_PRINT);
        return true;
      } else {
        static::help();
        return false;
      }
    }
7630
private function eval(...$args)
    {
        $return = $this->client->eval(...$args);

        if ($this->client->getLastError()) {
            throw new \BadMethodCallException($this->client->getLastError());
        }

        return $return;
    }
1270570
private function executeMethod($method, $args = [])
    {
        if (method_exists($this, $method)) {
            return call_user_func_array([$this, $method], $args);
        }
    }