Executes the $callable method by passing the queued messages one at a time.
If the callable returns false or throws an exception, the message will be re-queued

@param \AMQPQueue $queue
@param callable $callable
@return void
337250
protected function _consume(AMQPQueue $queue, callable $callable)
    {
        $tag = uniqid() . microtime(true);

        $callback = function (AMQPEnvelope $envelope, AMQPQueue $queue) use ($callable) {
            return $this->_callback($callable, $envelope, $queue);
        };

        $queue->consume($callback, AMQP_NOPARAM, $tag);
    }
883598
function transact(callable $callable) {
		$this->beginTransaction();
		try {
			call_user_func($callable);
			$this->commit();
		} catch (Exception $e) {
			$this->rollBack();
			throw $e;
		}
	}
662743
public static function call(callable $callable, $args=null)
    {

        if (!is_array($args)) {
            $args = $args === null ? [] : [$args];
        }

        return static::callFast($callable, static::evaluateArgs($args));

    }
661089
protected function callFast(callable $callable, array $params = [])
    {

        // call_user_func_array seems to be slow
        switch (count($params)) {
            case 1:
                return call_user_func($callable, $params[0]);
            case 2:
                return call_user_func($callable, $params[0], $params[1]);
            case 3:
                return call_user_func($callable, $params[0], $params[1], $params[2]);
            case 4:
                return call_user_func($callable, $params[0], $params[1], $params[2], $params[3]);
            default:
                return call_user_func_array($callable, $params);
        }
    }
896874
public function invoke(Callable $callable)
	{
		$reflection = $this->reflectCallable($callable);

		$args = [];

		foreach($reflection->getParameters() as $param) {
			$type = $param->getClass()->getName();

			if (in_array($type, $this->resolving)) {
				throw new \LogicException("Recursive dependency: $type is currently instatiating.");
			}

			$args[] = ($param->allowsNull() && !isset($this[$type])) ? null : $this[$type];
		}

		return call_user_func_array($callable, $args);
	}
39745
public function push(callable $callback)
    {
        if ($callback instanceof self) {
            $this->queue = array_merge($this->queue, $callback->queue);
            return;
        }

        $this->queue[] = $callback;
    }
216275
public <T> T execute(final Callable<T> callable) throws Exception {
        int attempts = 0;
        int maxAttempts = retryPolicy.getMaxAttempts();
        long delay = retryPolicy.getDelay();
        TimeUnit timeUnit = retryPolicy.getTimeUnit();
        while(attempts < maxAttempts) {
            try {
                attempts++;
                beforeCall();
                T result = callable.call();
                afterCall(result);
                return result;
            } catch (Exception e) {
                onException(e);
                if (attempts >= maxAttempts) {
                    onMaxAttempts(e);
                    throw e;
                }
                beforeWait();
                sleep(timeUnit.toMillis(delay));
                afterWait();
            }
        }
        return null;
    }
682217
private function enqueue(MessageInterface $message, callable $next): void
    {
        $this->queue[] = function () use ($message, $next): void {
            $next($message);
        };
    }
426454
function run(callable $callback = null) {
        if (isset($this->res))
            return null;
        $this->res = proc_open($this->cmd, $this->descriptor_spec, $this->pipes, $this->cwd, $this->env);
        if ($this->res) {
            $this->stdout = new TcpConnection($this->pipes[1]);
            if (is_callable($this->onMessage))
                $this->stdout->onMessage = function ($conn, $data) {
                    ($this->onMessage)($this, $data);
                };
            if (is_callable($this->onClose))
                $this->stdout->onClose = function () {
                    ($this->onClose)($this);
                };
            stream_set_blocking($this->pipes[0], false);
            if (is_callable($callback))
                $callback($this);
            return true;
        }
        unset ($this->res);
        return false;
    }
731543
public static function invokeWith($level, \Closure $callable)
    {
        $oldLevel = error_reporting($level);
        self::enableErrorToException($level);

        try {
            call_user_func($callable);
        } catch (\Exception $e) {
            self::disableErrorToException();
            error_reporting($oldLevel);
            throw $e;
        }

        self::disableErrorToException();
        error_reporting($oldLevel);
    }
1068371
protected function callHandler(
        callable $callable,
        ServerRequestInterface $request,
        ResponseInterface $response,
        array $routeArguments
    ) {
        # Action is a closure
        if ($callable instanceof Closure) {
            array_unshift($routeArguments, $request, $response);
            $result = call_user_func_array($callable, $routeArguments);
        } else {
            # Action is a method of an Action class
            if (is_array($callable) && $callable[0] instanceof Action\ActionInterface) {
                $callable[0]->setResponse($response);
                $callable[0]->setRequest($request);
            }

            # Call Action method
            $result   = $this->callAction($callable, $request, $response, $routeArguments);
            /** @var Action\ActionInterface $action */
            $action   = $callable[0];
            $response = $action->getResponse();
        }

        if (($result instanceof ResponseInterface)) {
            $response = $result;
        } else {
            $response = $this->buildResponse($result, $response, $request);
        }

        return $response;
    }
927745
protected function executeCallable($callable, array $arguments = [])
    {
        // resolve a pseudo callable to real callable
        $call = $this->resolvePseudoCallable($callable);

        // execute the callable
        return call_user_func_array(
            $call,
            $this->resolveCallableArguments($call, $arguments)
        );
    }
160624
public function execute($command, callable $next)
    {
        $this->queue[] = function () use ($command, $next) {
            return $next($command);
        };

        if ($this->isExecuting) {
            return;
        }
        $this->isExecuting = true;

        try {
            $returnValue = $this->executeQueuedJobs();
        } catch (\Exception $e) {
            $this->isExecuting = false;
            $this->queue = [];
            throw $e;
        }

        $this->isExecuting = false;
        return $returnValue;
    }
1275156
public function search(callable $callable)
    {
        foreach ($this as $key => $row) {
            if (call_user_func_array($callable, [$row, $key])) {
                return $row;
            }
        }

        return null;
    }
67583
public function invoke($callable, $arguments = []): self
    {
        // If one argument given for each iteration, create an array for it.
        if (!\is_array($arguments)) {
            $arguments = \array_fill(
                0,
                \count($this->getArray(), \COUNT_NORMAL),
                $arguments
            );
        }

        // If the callable has arguments, pass them.
        if ($arguments) {
            $array = \array_map($callable, $this->getArray(), $arguments);
        } else {
            $array = $this->map($callable);
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
808195
public function call($key, $callable)
    {
        if (!is_callable($callable)) {
            throw new \InvalidArgumentException('Not a valid callable.');
        }

        if ($this->exists($key)) {
            return $this->get($key);
        }

        $args = func_get_args();
        array_shift($args);
        array_shift($args);

        $value = call_user_func_array($callable, $args);

        $this->set($key, $value);

        return $value;
    }
164671
public function insert($table, callable $callable = null)
    {

        $this->connect($table);
        $insert = new Insert($this);

        return $callable($insert);
    }