Applies the given callback to all bundle extensions that are
defined in the application and returns an array with the results
of each call.

@param callable $callback
@return array(mixed)
161435
protected function applyToExtensions($callback)
    {
        $results = array();
        foreach (new ApplicationBundleIterator($this->kernel) as $bundle) {
            /* @var $bundle BundleInterface */
            $extension = $bundle->getContainerExtension();
            if ($extension !== null) {
                $results[] = call_user_func($callback, $extension);
            }
        }
        return $results;
    }
328468
public function each(callable $callback)
	{
		foreach ($this->members as $key => $member)
		{
			if ($callback($key, $member) === false) {
				break;
			}
		}
		return $this;
	}
619037
public function map(callable $callback) {
        $handle = opendir($this->fullName);
        while (false !== ($name = readdir($handle))) {
            if ($name == '.' || $name == '..') {
                continue;
            }
            $file = $this->fullName.'/'.$name;
            $result = call_user_func($callback,
                is_dir($file) ? new static($file) : new File($file));
            if ($result === false) {
                break;
            }
        }
    }
1315054
public function getSumCallback($callback)
    {
        $callback = $this->getCallback($callback);

        // return array_sum(array_map($callback, $this->edges));

        $sum = 0;
        foreach ($this->edges as $edge) {
            $sum += $callback($edge);
        }
        return $sum;
    }
1300279
public static function toNative($callback)
    {
        if (!is_array($callback)) {
            return self::getNative($callback);
        }
        if (!array_key_exists('0', $callback)) {
            return self::getFromDict($callback);
        }
        if (!array_key_exists(2, $callback)) {
            return self::getNative($callback);
        }
        return self::getFromList($callback);
    }
1002001
public function usort(callable $callback): Collection
    {
        $index = 0;
        $items = $this->items;

        foreach ($items as &$item) {
            $item = [$index++, $item];
        }

        usort($items, function ($a, $b) use ($callback) {
            $result = call_user_func($callback, $a[1], $b[1]);

            return $result === 0 ? $a[0] - $b[0] : $result;
        });

        foreach ($items as &$item) {
            $item = $item[1];
        }

        return new static($items);
    }
751931
public function each(callable $callback)
    {
        foreach ($this->items as $key => $item) {
            $result = $callback($item, $key);

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

            if (!is_object($item)) {
                $this->items[$key] = $result;
            }
        }

        return $this;
    }
797045
public function filter( $callback ) {

			$result = [];

			if ( is_callable( $callback ) ) {

				for ( $i=0; $i<$this->len; $i++ ) {
					if ( call_user_func( $callback, $this->items[$i], $i, $this ) ) {
						$result[] = &$this->items[$i];
					}
				}

			}

			$myName = get_class();

			return new $myName( $result );

		}
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;
	}
737577
private function getParameters(callable $callback)
    {
        if (is_array($callback)) {
            $mirror = new ReflectionMethod($callback[0], $callback[1]);
        } elseif (is_object($callback) && !$callback instanceof \Closure) {
            /** @var object $callback */
            $mirror = new ReflectionObject($callback);
            $mirror = $mirror->getMethod('__invoke');
        } else {
            $mirror = new ReflectionFunction($callback);
        }

        return $mirror->getParameters();
    }
981898
public function filter(callable $callback): CollectionInterface
    {
        $collection = clone $this;
        $collection->data = \array_merge([], \array_filter($collection->data, $callback));

        return $collection;
    }
235196
public function mapToDictionary(callable $callback)
    {
        $dictionary = [];

        foreach ($this->items as $key => $item) {
            $pair = $callback($item, $key);

            $key = key($pair);

            $value = reset($pair);

            if (! isset($dictionary[$key])) {
                $dictionary[$key] = [];
            }

            $dictionary[$key][] = $value;
        }

        return new static($dictionary);
    }
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;
    }
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;
                }
            }
        });
    }
712786
public function each($callback)
    {
        Argument::i()->test(1, 'callable');

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

        return $this;
    }
493938
protected function prepareCallbacks($callbacks)
    {
        if (is_array($callbacks)) {
            foreach ($callbacks as &$callback) {
                $callback['callback'] = $this->serializeClosure($callback['callback']);
            }
        } else {
            $callbacks = $this->serializeClosure($callbacks);
        }

        return $callbacks;
    }
1290622
public function each(callable $callback)
    {
        $array = $this->getArrayCopy();
        foreach ($array as $key => $value) {
            $callback($value, $key, $array);
        }
    }