resolve

@param callable $callback

@return  Response[]
@throws \RuntimeException
549479
public function resolve(callable $callback = null)
    {
        $active = null;
        $mh = $this->getMainHandle();

        do {
            $mrc = curl_multi_exec($mh, $active);
        } while ($mrc === CURLM_CALL_MULTI_PERFORM);

        while ($active && $mrc === CURLM_OK) {
            if (curl_multi_select($mh) === -1) {
                usleep(100);
            }

            do {
                $mrc = curl_multi_exec($mh, $active);
            } while ($mrc === CURLM_CALL_MULTI_PERFORM);
        }

        if ($mrc !== CURLM_OK) {
            throw new \RuntimeException("Curl multi read error $mrc\n", E_USER_WARNING);
        }

        /** @var CurlTransport $transport */
        $responses = [];
        $errors = [];
        $transport = $this->getTransport();

        foreach ($this->tasks as $task) {
            /** @var Promise $promise */
            $handle = $task['handle'];
            $promise = $task['promise'];

            $error = curl_error($handle);

            if (!$error) {
                $responses[] = $res = $transport->getResponse(curl_multi_getcontent($handle), curl_getinfo($handle));
                $promise->resolve($res);
            } else {
                $errors[] = $e = new \RuntimeException($error, curl_errno($handle));
                $promise->reject($e);
            }
        }

        $this->errors = $errors;

        if ($callback) {
            $callback($responses, $errors, $this);
        }

        $this->reset();

        return $responses;
    }
1307665
public function prepareCallback($callback)
    {
        $result       = $callback;
        if (is_string($callback) && ($callbackInfo = $this->parseHandlerStr($callback))
            && class_exists($callbackInfo['class']) && method_exists(($controller
                = new $callbackInfo['class']), $callbackInfo['method'])) {
            $result = [$controller, $callbackInfo['method']];
        } elseif (!is_callable($callback)) {
            throw new \pwf\exception\HttpNotFoundException();
        }
        return $result;
    }
994845
protected static function callback($callback)
    {
        if( is_string($callback) && ! is_callable($callback) )
        {
            return self::controllerCallback($callback);
        }

        return $callback;
    }
1290622
public function each(callable $callback)
    {
        $array = $this->getArrayCopy();
        foreach ($array as $key => $value) {
            $callback($value, $key, $array);
        }
    }
1066566
public function map($callback) : ArrayList
    {
        $values = $this->_map($callback);
        $this->setValues($values);
        return $this;
    }
1253268
public function each(callable $callback): CollectionInterface
    {
        if ($callback instanceof Closure) {
            $callback = $this->bindCallback($callback);
        }

        foreach ($this->generator() as $key => $value) {
            call_user_func($callback, $key, $value);
        }

        return $this;
    }
779135
public function call(callable $callback): Response
    {
        foreach (self::METADATA_KEYS as $incomingKey => $metadataKey) {
            if (array_key_exists($incomingKey, $_SERVER)) {
                $this->metadata[$metadataKey] = ['' . $_SERVER[$incomingKey]];
            }
            if (array_key_exists($incomingKey, $_REQUEST)) {
                $this->metadata[$metadataKey] = ['' . $_REQUEST[$incomingKey]];
            }
        }
        $response = $callback();
        return $response;
    }
580477
public function converter(callable $callback, string ...$types): ResolverInterface
    {
        $rule = RuleFactory::converter($callback, ...$types);
        $this->addRule($rule, self::LOW_PRIORITY);

        return $this;
    }
122020
private function run($callback)
    {
        $injects = [];
        $reflectionFunction = new \ReflectionFunction($callback);
        foreach ($reflectionFunction->getParameters() as $parameter) {
            if ($class = $parameter->getClass()) {
                $injects[] = app($class->name);
            }
        }

        return call_user_func_array($callback, $injects);
    }
22674
public function filter(callable $callback): self
    {
        $collection = Factory::create();
        $index      = 0;
        foreach ($this->items as $key => $value) {
            if ($callback($value, $key, $index++)) {
                $collection->set($key, $value);
            }
        }

        return $collection;
    }
1098281
public static function resolved(Closure $callback)
    {
        static::$app->afterResolving(static::getFacadeAccessor(), function ($service) use ($callback) {
            $callback($service);
        });
    }
220444
public function rule(callable $callback, string ...$types): ResolverInterface
    {
        $rule = RuleFactory::rule($callback, ...$types);
        $this->addRule($rule, self::NORMAL_PRIORITY);

        return $this;
    }
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));
    }
392039
public function handleRemaining(callable $callback)
    {
        $properties = $this->getRemainingMutations();
        if (!$properties) {
            // Nothing to do, don't register callback
            return;
        }

        foreach ($properties as $propertyName) {
            // HTTP Accepted
            $this->result[$propertyName] = 202;

            $this->propertyUpdateCallbacks[] = [
                $properties,
                $callback,
            ];
        }
    }
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;
                }
            }
        });
    }
674981
protected function onStrategies(callable $callback)
    {
        $this->results = [];
        foreach ($this->strategies as $strategy) {
            $instance = $this->getStrategy($this->type, $strategy, $this->options);
            if ($instance) {
                $this->results[$strategy] = $callback($instance);
                if (!$this->checkResults($this->results[$strategy])) {
                    break;
                }
            } else {
                $this->results[$strategy] = true;
            }
        }

        return $this->results;
    }
1036459
public function each(callable $callback)
    {
        foreach ($this->all() as $key => $value) {
            $callback($key, $value);
        }

        return $this;
    }