Compatibility Method for array_filter on <5.6 systems

@param array $data
@param callable $callback
@param null|int $flag
@return array
355602
public static function filter(array $data, $callback, $flag = null)
    {
        if (! is_callable($callback)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Second parameter of %s must be callable',
                __METHOD__
            ));
        }

        if (version_compare(PHP_VERSION, '5.6.0') >= 0) {
            return array_filter($data, $callback, $flag);
        }

        $output = [];
        foreach ($data as $key => $value) {
            $params = [$value];

            if ($flag === static::ARRAY_FILTER_USE_BOTH) {
                $params[] = $key;
            }

            if ($flag === static::ARRAY_FILTER_USE_KEY) {
                $params = [$key];
            }

            $response = call_user_func_array($callback, $params);
            if ($response) {
                $output[$key] = $value;
            }
        }

        return $output;
    }
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 );

		}
97130
final protected function filter(array &$data, array $scheme = [])
    {
        if (empty($scheme)) {
            $scheme = $this->scheme;
        }

        if (empty($scheme['filter'])) {
            return $data;
        }

        $filter = [];

        foreach ($scheme['filter'] as $f => $r) {
            $filter[$f] = $r;
        }

        if (empty($filter)) {
            return $data;
        }

        $result = filter_var_array($data, $filter);

        if (empty($result)) {
            return $data;
        }

        foreach ($result as $key => $value) {
            $data[$key] = $value;
        }

        return $data;
    }
534124
protected function filterByKey(array $array, callable $callback)
    {
        $newArray = [];
        foreach ($array as $key => $value) {
            if (true === $callback($key, $value)) {
                $newArray[$key] = $value;
            }
        }

        return $newArray;
    }
1204970
public function plain($view, array $data, $callback=null)
    {
        return $this->send(['text'=>$view], $data, $callback);
    }
178117
public function filter(callable $callback = null): CollectionInterface
    {
        if (!$callback) {
            $callback = function ($item) {
                return (bool)$item;
            };
        }

        return $this->wrap(function (Iterator $data) use ($callback) {
            foreach ($data as $key => $item) {
                if ($callback($item, $key)) {
                    yield $key => $item;
                }
            }
        });
    }
320103
public static function filterArray(array $array, Closure $callback)
    {
        foreach ($array as $index => $collection) {
            $array[$index] = call_user_func($callback, $collection);
        }

        return $array;
    }
1306228
public function reject($callback): Collection
    {
        if ($this->useAsCallable($callback)) {
            return $this->filter(function ($key, $value) use ($callback) {
                return ! $callback($value, $key);
            });
        }

        return $this->filter(function ($key, $item) use ($callback) {
            return $item != $callback;
        });
    }
609685
protected function _moveNode(Closure $callback, array $data) {
        return $this->getRepository()->updateMany($data, $callback, [
            'before' => false,
            'after' => false
        ]);
    }
67991
public function filter(\Closure $callback, $reindex = true) {
		$result = array_filter($this->annotations, $callback);
		
		if ($reindex) {
			$result = array_values($result);
		}
		
		return $result;
	}
532949
public function filter(callable $callback = null)
    {
        if (!is_null($callback)) {
            return new static(
                $this->wye,
                array_filter($this->items, $callback, ARRAY_FILTER_USE_BOTH)
            );
        }

        return new static($this->wye, array_filter($this->items));
    }
1238081
public function filter($callback = null)
    {
        $test = array_filter($this->data, $callback);
        $clone = clone $this;
        return $clone->reset($test);
    }
118830
public function filter(array $data)
    {
        $filtered = [];

        foreach ($data as $row) {
            if ($this->passesFilter($row)) {
                $filtered[] = $row;
            }
        }

        return $filtered;
    }
1049397
public function setCallback($data = [])
    {
        if (is_array($data)) {

            if (array_key_exists('callbackOnFail', $data)) {
                $this->setSecondaryCallbackURL($data['callbackOnFail']);
            }

            if (array_key_exists('callbackOnSuccess', $data)) {
                $this->setPrimaryCallbackURL($data['callbackOnSuccess']);
            }

            if (array_key_exists('error', $data)) {
                $this->setSecondaryCallbackURL($data['error']);
            }

            if (array_key_exists('success', $data)) {
                $this->setPrimaryCallbackURL($data['success']);
            }

            if (array_key_exists('callback', $data)) {
                $this->setCallback($data['callback']);
            }
        }

        return $this->callback($data);
    }
91793
public function group($data, $callback = null)
    {
        if (is_callable($data)) {
            $callback = $data;
            $data = null;
        }

        if ($data) {
            $this->prefix[] = $data;
        }

        call_user_func($callback, $this);

        if ($data) {
            array_pop($this->prefix);
        }
    }
239125
public function boolean($data, $default = false, $options = [])
    {

        //check custom filters and flags in options array;
        list($filter, $flags, $parameters) = $this->readFiltersAndFlags(
            $options,
            static::FILTER_BOOLEAN
        );
        //push custom filters and flags from options to their respective array;

        $boolean = $this->scrub($data, $filter, $parameters);

        return (boolean)$boolean;
    }
475042
public static function reject(array $data, callable $callback, $keepKey = false)
    {
        return static::find(
            $data,
            function (&$value, &$key) use ($callback) {
                if (is_string($callback)) {
                    return !$callback($value);
                }

                return !$callback($value, $key);
            },
            $keepKey
        );
    }