Resolve callback

@param  callable $callback

@return array

@throws ControllerNotFoundException
175322
protected function resolveCallback($callback)
    {
        if ($this->resolver) {
            return call_user_func_array($this->resolver, [$callback]);
        }

        if (!class_exists($callback[0])) {
            throw new ControllerNotFoundException("Controller '{$callback[0]}' not found");
        }

        return [
            new $callback[0],
            $callback[1]
        ];
    }
1295386
public function resolveCallback(Closure $callback, $params = [])
    {
        $reflectionParameter = new ReflectionFunction($callback);

        $dependencies = $reflectionParameter->getParameters();

        return $this->getDependencies($dependencies, $params);
    }
464696
protected function prepareCallbacks(callable $callback/*, ... */) {
		list($init, $done, $then) = $this->getCallbacks();
		
		$context = $init();
		foreach (func_get_args() as $cb) {
			$then($context, $cb);
		}
		
		return array($context, function($result) use ($context, $done) {
			$done($context, $result);
		});
	}
728128
protected function handleClassCallback(string $callback): array
    {
        list($class, $method) = $this->parseCallback($callback);
        $instance = $this->container->make($class);

        return [$instance, $method];
    }
580477
public function converter(callable $callback, string ...$types): ResolverInterface
    {
        $rule = RuleFactory::converter($callback, ...$types);
        $this->addRule($rule, self::LOW_PRIORITY);

        return $this;
    }
770086
public function pipeline(callable $callback = null)
    {
        $pipeline = $this->client()->pipeline();

        return is_null($callback)
            ? $pipeline
            : tap($pipeline, $callback)->exec();
    }
346606
protected function getCallback($callback)
	{
		if ( ! is_null($callback)) return $callback;

		$me = $this;

		return function($line) use ($me) { $me->display($line); };
	}
1110130
public function map(callable $callback = null)
	{
		return $callback ? array_map($callback, $this->list) : $this->list;
	}
1144696
public function map(callable $callback): CollectionInterface
    {
        $collection = clone $this;
        \array_map($callback, $collection->data);

        return $collection;
    }
919736
public function resolving($abstract, Closure $callback = null)
	{
		if ($callback === null && $abstract instanceof Closure)
		{
			$this->resolvingCallback($abstract);
		}
		else
		{
			$this->resolvingCallbacks[$abstract][] = $callback;
		}
	}
960681
public function getObjects(callable $callback = null)
    {
        foreach ($this->resourceManager->getCollectionsByStorage($this) as $collection) {
            yield $this->getObjectsByCollection($collection, $callback);
        }
    }
141205
public function each(callable $callback)
    {
        foreach ($this->nodes as $index => $node) {
            $return_value = \call_user_func($callback, $node, $index);

            if ($return_value === false) {
                break;
            }
        }

        return $this;
    }
297494
private function getArguments(callable $callback, array $callbackArguments)
    {
        $parameters = $this->getParameters($callback);
        $arguments = [];
        foreach ($parameters as $param) {
            if (array_key_exists($param->getName(), $callbackArguments)) {
                $arguments[] = $callbackArguments[$param->getName()];
            } elseif ($param->isDefaultValueAvailable()) {
                $arguments[] = $param->getDefaultValue();
            } else {
                $arguments[$param->getName()] = null;
            }
        }

        return $arguments;
    }
132087
public function mapWithKeys(callable $callback): CollectionInterface
    {
        return $this->wrap(function (Iterator $data) use ($callback) {
            foreach ($data as $key => $value) {
                /** @var iterable $result */
                $result = $callback($value, $key);

                foreach ($result as $resultKey => $resultValue) {
                    yield $resultKey => $resultValue;
                }
            }
        });
    }
910107
private function normaliseCallbackString(string $callback) : string
    {
        @list($controller, $method) = explode('@', $callback);

        if (class_exists($this->defaultControllerNamespace . $controller)) {
            return $this->defaultControllerNamespace . $callback;
        }

        return $callback;
    }
605928
protected function commandCallback($callback)
    {
        return (
            function ($output) use ($callback) {
                $this->output .= $output;
                if (is_callable($callback)) {
                    return call_user_func($callback, $output);
                }
            }
        );
    }
416927
public function filter(callable $callback = null)
    {
        if ($callback === null) {
            return new static(\array_filter($this->all()));
        }

        return new static(\array_filter($this->all(), $callback));
    }