php-rules / rules-filter
a sample test for composer
Package info
github.com/inforob/php-rules-rules-filter
Type:project
pkg:composer/php-rules/rules-filter
1.0.1
2019-07-03 18:33 UTC
Requires
- php: >=7.0.0
This package is not auto-updated.
Last update: 2026-03-21 02:41:19 UTC
README
a rules repository
You can create new Rules for your array filters as follow:
declare(strict_types = 1); namespace App; class ContainerRulesArrayMap { private $rules = []; private $items = []; public function __construct(array $tasks) { $this->items = $tasks; } public function addRule(Rule $rule) : void { $this->rules[] = $rule; } /** * execRule * * run each rule and aply the filter method * to each item from array origin * * * @return void */ public function execRule() : void { foreach ($this->rules as $rule) { $this->items = $rule->map($this->items); } }