16 lines
280 B
PHP
16 lines
280 B
PHP
<?php
|
|
namespace nulib\php\iter;
|
|
|
|
use Generator;
|
|
|
|
trait TFiltrable {
|
|
function applyFilter($filter): Generator {
|
|
$filter = Filter::with($filter);
|
|
foreach ($this as $value) {
|
|
if ($filter->matchValue($value)) {
|
|
yield $value;
|
|
}
|
|
}
|
|
}
|
|
}
|