ScriptFUSION\Porter\Porter::filter PHP Method

filter() private method

private filter ( ProviderRecords $records, callable $predicate, $context )
$records ScriptFUSION\Porter\Collection\ProviderRecords
$predicate callable
    private function filter(ProviderRecords $records, callable $predicate, $context)
    {
        $filter = function () use($records, $predicate, $context) {
            foreach ($records as $record) {
                if ($predicate($record, $context)) {
                    (yield $record);
                }
            }
        };
        return new FilteredRecords($filter(), $records, $filter);
    }