@param callable $callback Success callback

@return array
171182
public function archiveFiles(callable $callback)
    {
        $archiveFilenames = [];

        foreach ($this->getDirs() as $param => $dir) {
            $filename = $this->nameArchive($dir, 'local');

            if (!$this->archiver->archive(sprintf('%sweb/%s', $this->getProjectPath(), $dir), $this->getProjectPath().$filename)) {
                continue;
            }

            $callback($filename);

            $archiveFilenames[$param] = $this->filesToRemove[] = $filename;
        }

        return $archiveFilenames;
    }
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,
            ];
        }
    }
1153479
public function map(callable $callback): Collection
    {
        $keys = array_keys($this->items);
        $items = array_map($callback, $this->items, $keys);

        return new static(array_combine($keys, $items));
    }
1311185
private function _last(callable $callback = null)
    {
        $values = $this->getValues();
        if ($callback){
            foreach(array_reverse($values) as $key => $value){
                if ($callback($value, $key)){
                    return $value;
                }
            }
        }
        else{
            return empty($values) ? null : $values[count($values)-1];
        }
        return null;
    }
661087
public function contains(callable $callback)
    {
        foreach (array_keys($this->storage) as $priority) {
            if (false !== ($index = array_search($callback, $this->storage[$priority], true))) {
                return true;
            }
        }
        return false;
    }
1051603
public function __findAll($callback):array{

		if(!\is_callable($callback)){
			throw new TraitException('invalid callback');
		}

		$return = [];

		foreach($this->array as $index => $element){

			if(\call_user_func_array($callback, [$element, $index]) === true){
				$return[] = $element;
			}

		}

		return $return;
	}
935359
public static function callback(callable $callback) : callable
    {
        return function (Message $message) use ($callback) {
            if ($message->getMessage()) {
                $return = Envelope::unserialize($message->getMessage());
                $return->headers['history'][] = new EnvelopeHistory($message->getWorkerId());

                return $callback($message, $return);
            } else {
                return $callback($message);
            }
        };
    }
422067
private function _sort(callable $callback = null) : array
    {
        $values = $this->getValues();
        if ($callback){
            usort($values, $callback);
        }
        else{
            sort($values);
        }
        return $values;
    }
86744
protected function checkAndReturnCallable($callback)
    {
        if (is_string($callback)) {
            return function ($app) use ($callback) {
                return $app($callback);
            };
        }

        if (!is_callable($callback)) {
            $type = is_object($callback) ? get_class($callback) : gettype($callback);
            throw new InvalidArgumentException("Passed argument of type $type is not callable");
        }

        return $callback;
    }
588082
public function mapToDictionary(callable $callback)
    {
        $dictionary = $this->map($callback)->reduce(function ($groups, $pair) {
            $groups[key($pair)][] = reset($pair);

            return $groups;
        }, []);

        return new static($dictionary);
    }
86190
public function mapSpread(callable $callback)
    {
        return $this->map(function ($chunk, $key) use ($callback) {
            $chunk[] = $key;

            return $callback(...$chunk);
        });
    }
177261
public function map(callable $callback): Map
    {
        $apply = function($pair) use ($callback) {
            return $callback($pair->key, $pair->value);
        };

        return new self(array_map($apply, $this->pairs));
    }
223722
public function build(callable $callback): array
    {
        $data = [];

        foreach (['includes', 'excludes'] as $key) {
            if (! empty($this->{$key})) {
                $data[$key] = \implode(',', $this->{$key});
            }
        }

        if (! \is_null($this->timezone)) {
            $data['timezone'] = $this->timezone;
        }

        if (\is_int($this->page) && $this->page > 0) {
            $data['page'] = $this->page;

            if (\is_int($this->perPage) && $this->perPage > 5) {
                $data['per_page'] = $this->perPage;
            }
        }

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

        return $this;
    }
341296
private function _first(callable $callback = null)
    {
        $values = $this->getValues();
        if ($callback){
            foreach($values as $key => $value){
                if ($callback($value, $key)){
                    return $value;
                }
            }
        }
        else{
            return empty($values) ? null : $values[0];
        }
        return null;
    }
277875
public function extract(callable $callback = null)
    {

        if ($callback === null) {
            $result = $this->result->toArray();
        }
        else {
            $result = $callback($this->result->toArray());
        }

        return $result;

    }
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;
    }