Execute middlewares

@param callable $final
@param callable|null $fail
@param array $args Arguments for middleware
@return mixed
550399
public function run(array $args = [], callable $final = null, callable $fail = null)
    {
        $result = null;

        // declare default final middleware
        if (!is_callable($final)) {
            $final = function ($command) {
                return $command;
            };
        }

        // declare default error middleware
        if (!is_callable($fail)) {
            $fail = function ($exception) {
                throw $exception;
            };
        }

        try {
            $result = $this->handle($args, $final);
        } catch (\Exception $exception) {
            $result = $this->handleError($args, $fail, $exception, $result);
        }

        return $result;
    }
957258
public function execute($callable = null)
    {
        if ($callable && !is_callable($callable)) {
            throw new \InvalidArgumentException('The argument must be a callable object.');
        }

        $exception = null;
        $this->setRunning(true);

        try {
            if ($callable) {
                call_user_func($callable, $this);
            }

            $this->flushPipeline();
        } catch (\Exception $exception) {
            // NOOP
        }

        $this->setRunning(false);

        if ($exception) {
            throw $exception;
        }

        return $this->responses;
    }
223427
public function executeCommand(array $args, OutputInterface $output, $message)
    {
        $name = $args[0];
        $cmd = $this->getCmd($args);

        $output->writeln('');
        $output->writeln(
            sprintf(
                '<info>Running %s</info>',
                $name
            )
        );

        $output->writeln(
            sprintf(
                '<comment>%s</comment>',
                $cmd
            )
        );

        $this->process->setCommandLine($cmd);
        $this->process->run(
            function ($type, $buffer) use ($output, $cmd) {
                if (Process::ERR === $type) {
                    $output->writeln(
                        sprintf(
                            '<error>%s</error>',
                            $buffer
                        )
                    );
                } else {
                    $output->writeln(
                        sprintf(
                            '<comment>%s</comment>',
                            $buffer
                        )
                    );
                }
            }
        );

        if (!$this->process->isSuccessful()) {
            throw new \RuntimeException($message . '<error>' . $this->process->getErrorOutput() . '</error>');
        }
    }
735535
private function execute_callback(
		callable $callback, array $args, bool $is_raw=null
	) {
		$method = strtolower($this->request_method);

		if (in_array($method, ['head', 'get', 'options']))
			return $this->finish_callback($callback, $args);

		if ($method == 'post') {
			$args['post'] = $is_raw ?
				file_get_contents("php://input") : $_POST;
			if (isset($_FILES) && !empty($_FILES))
				$args['files'] = $_FILES;
			return $this->finish_callback($callback, $args);
		}

		if (in_array($method, ['put', 'delete', 'patch'])) {
			$args[$method] = file_get_contents("php://input");
			return $this->finish_callback($callback, $args);
		}

		# TRACE, CONNECT, etc. is not supported, in case web server
		# hasn't disabled them
		self::$logger->warning(sprintf(
			"Router: %s not supported in '%s'.",
			$this->request_method, $this->request_path));
		$this->abort(405);

		# always return self for chaining even if aborted
		return $this;
	}
731015
static function executeCallback($callback, array $params = array()) {
    // If callback has @
    if (is_string($callback) && strpos($callback, '@') !== false) {
      // Split
      $arrCallback = explode('@', $callback);
      // Set object
      $object = class_exists($arrCallback[0]) ? (new $arrCallback[0]()) : null;
      // Set method
      $method = isset($arrCallback[0]) ? $arrCallback[0] : null;
      // Set callback
      $callback = array($object, $method);
    }
    // If not callable
    if ( ! is_callable($callback)) {
      // Throw error
      throw new InvalidCallback('Callback must be callable');
    }
    // Execute and return
    return call_user_func_array($callback, $params);
  }
437474
public function execute(array $args = [], array $options = [])
    {
        /** @var CommandInterface[] $commands */
        $commands = $this->getConfig()->get('commands');

        $all = isset($options['all']) && true === $options['all'];

        $selectedCommands = [];
        foreach ($commands as $n => $c) {
            $hidden = false;
            $realName = $n;
            if ('_' === $n{0}) {
                if (!$all) {
                    continue;
                }
                $hidden = true;
                $n = substr($n, 1);
            }
            $selectedCommands[$n] = ['hidden' => $hidden, 'realName' => $realName, 'command' => $c];
        }

        ksort($selectedCommands);

        $user = $this->getConfig()->get('user_name');

        if ($user) {
            $this->writeln('<comment>DEV Console command</comment> (Happy hacking %s !)', $user);
        } else {
            $this->writeln('<comment>DEV Console command</comment>');
        }
        $this->writeln();
        $this->writeln('%d commands:', count($selectedCommands));

        $max = 0;

        foreach ($selectedCommands as $commandName => $def) {
            $len = strlen($commandName);
            $max = $max < $len ? $len : $max;
        }

        $lastLetter = null;

        foreach ($selectedCommands as $commandName => $def) {
            $letter = $commandName{0};
            if ($lastLetter !== $letter) {
                $this->writeln();
            }
            /** @var CommandInterface $command */
            $command = $def['command'];
            $command->setConfig($this->getConfig());
            $this->writeln("  <".($def['hidden'] ? 'comment' : 'info').">%-".$max."s</".($def['hidden'] ? 'comment' : 'info').">  <comment>%s</comment>", $commandName, $command->getDescription());
            $lastLetter = $letter;
        }

        $this->writeln();
    }
233267
protected static function invokeWithErrorHandler(callable $callback, ...$args)
	{
		if(self::$errorHandler === NULL)
		{
			self::$errorHandler = function ($type, $message, $file, $line) {
				throw new \RuntimeException($message);
			};
		}
		
		set_error_handler(self::$errorHandler);
		
		try
		{
			return $callback(...$args);
		}
		finally
		{
			restore_error_handler();
		}
	}
1151736
public function execute(array $args, array $options = [])
    {
        $this->bootstrap($args, $options);

        $version = isset($options['target']) ? $options['target'] : $options['t'];
        $removeAll = isset($options['remove-all']) ? $options['remove-all'] : $options['r'];

        if ($version && $removeAll){
            throw new \InvalidArgumentException('Cannot toggle a breakpoint and remove all breakpoints at the same time.');
        }

        // Remove all breakpoints
        if ($removeAll){
            $this->getManager()->removeBreakpoints();
        } else {
            // Toggle the breakpoint.
            $this->getManager()->toggleBreakpoint($version);
        }
    }
7630
private function eval(...$args)
    {
        $return = $this->client->eval(...$args);

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

        return $return;
    }
1341743
public static function push($callable, $args = [], $options = [])
    {
        $config = Hash::get($options, 'config', 'default');
        $queue = static::queue($config);

        return $queue->push($callable, $args, $options);
    }
352354
public function push($callable, $args = [], $options = [])
    {
        $queue = $this->engine->setting($options, 'queue');
        $item = [
            'queue' => $queue,
            'class' => $callable,
            'args'  => [$args],
            'id'    => md5(uniqid('', true)),
            'queue_time' => microtime(true),
        ];
        $success = $this->engine->push($item, $options);

        unset($item['id']);
        if ($success) {
            $item['id'] = $this->engine->lastJobId();
        }

        $item['args'] = $args;
        $this->dispatchEvent('Queue.afterEnqueue', [
            'item' => $item,
            'success' => $success,
        ]);

        return $success;
    }
1150379
public function execute(array $args, array $options = [])
    {
        if (!isset($args[0])) {
            throw new \InvalidArgumentException('arg action must be input');
        }
        $action = explode('::', $args[0]);
        if (!class_exists($action[0])) {
            throw new \InvalidArgumentException('action not not found!');
        }

        if (isset($args[1])) {
            $frequency = abs(intval($args[1]));
        } else {
            $frequency = null;
        }
        ProcessManage::addTask($action, $frequency);
    }
1024779
public function execute(Arguments $args, ConsoleIo $io)
    {
        foreach (Configure::read('VENDOR_LINKS') as $origin => $target) {
            $this->createLink(
                $io,
                Folder::slashTerm(ROOT) . 'vendor' . DS . $origin,
                Folder::slashTerm(WWW_ROOT) . 'vendor' . DS . $target
            );
        }

        return null;
    }
1270570
private function executeMethod($method, $args = [])
    {
        if (method_exists($this, $method)) {
            return call_user_func_array([$this, $method], $args);
        }
    }
92489
protected function exec($command, array $arguments = array())
    {
        $command = $this->bin . ' ' . $command;

        $commandline = $this->cli->prepare($command, $arguments);

        if ($this->cli->execute($commandline) <> 0) {
            throw new ProcessFailedException($this->cli->getProcess());
        } elseif ($message = $this->cli->getErrorOutput()) {
            throw new \RuntimeException($message);
        }

        return $this->cli->getOutput();
    }
644255
def execute(args = [], **options)
      execute_internal(args, options)
      Executor::ExitCode.code(:success)
    rescue Cliqr::Error::CliqrError => e
      puts e.message
      Executor::ExitCode.code(e)
    end
294963
protected function doExecute()
    {
        $failer = $this->console->container->get('queue.failer');

        $all = $this->getOption('all');

        if ($all) {
            $ids = array_column($failer->all(), 'id');
        } else {
            $ids = $this->io->getArguments();

            if (!count($ids)) {
                throw new WrongArgumentException('No id provided');
            }
        }

        foreach ($ids as $id) {
            $failer->remove($id);

            if (!$all) {
                $this->out(sprintf('Remove failed-job: <info>%s</info>', $id));

                $failer->remove($id);
            }
        }

        if ($all) {
            $failer->clear();

            $this->out('All failed jobs cleared.');
        }

        return true;
    }