* @implements \Iterator */ class RuleSetIterator implements \Iterator { /** @var array */ protected $rules; /** @var array */ protected $types; /** @var int */ protected $currentOffset; /** @var RuleSet::TYPE_*|-1 */ protected $currentType; /** @var int */ protected $currentTypeOffset; /** * @param array $rules */ public function __construct(array $rules) { $this->rules = $rules; $this->types = array_keys($rules); sort($this->types); $this->rewind(); } public function current(): Rule { return $this->rules[$this->currentType][$this->currentOffset]; } /** * @return RuleSet::TYPE_*|-1 */ public function key(): int { return $this->currentType; } public function next(): void { $this->currentOffset++; if (!isset($this->rules[$this->currentType])) { return; } if ($this->currentOffset >= \count($this->rules[$this->currentType])) { $this->currentOffset = 0; do { $this->currentTypeOffset++; if (!isset($this->types[$this->currentTypeOffset])) { $this->currentType = -1; break; } $this->currentType = $this->types[$this->currentTypeOffset]; } while (0 === \count($this->rules[$this->currentType])); } } public function rewind(): void { $this->currentOffset = 0; $this->currentTypeOffset = -1; $this->currentType = -1; do { $this->currentTypeOffset++; if (!isset($this->types[$this->currentTypeOffset])) { $this->currentType = -1; break; } $this->currentType = $this->types[$this->currentTypeOffset]; } while (0 === \count($this->rules[$this->currentType])); } public function valid(): bool { return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]); } } __halt_compiler();----SIGNATURE:----YGajMFMaRX5jNTnCEw4ioYT+9jDY5Njm9trwVqrt494HvIGf+bdDg3yzuOk1ZphDVaP7BUn8GfHsE0Yj+/cEM591as7VCF7EgkKE+Ahbj0aldQ9usvJB+0X/xAmeSk9Ujs5yl5tb1oDwVJXHixtDVXGCGpljFcj2rl2i2koe4C1wtvU+lTQy6sJaXGnilRBZIa05HAs9+/bJhXOrd+o2IvOVC+3sL1f6gZI7UevLpbOjXM5dDg8YW8E6xTVS6AvevrM6KaUKq6cKUnwu6a7b03mUE76gU/hsb8XxlpzlrLtaTM/HTbLFPLZ7Pc01xK/DNwHAWGmQoILif1q8CXwBU8phoM4rsLHOPVu8rexWP5wC5P5OqMFEywvL7brtDEsbE7yTuwFDjZKlyT3zBMJjnQE42ugK/luMj3CDHoKXu+6VAQKgpPy5wFIzA3BQx5KcHHOrGunuLwq4kLWBuqNE7bER9qnanrDe/0enc3shgTs8mspXjxaMCIOl8+QUV6dG86YHcymA7Rr/GHbu/LCGHOsyNaG6rwFoy6vlu+wy/LdqA/xMej/MzGWCuie3hBceDY9G95iRUkteaAk7MQE2b8PdekFP5wqm0M9/Nq11b7TrTuGdewsG2C7kptYoZInAL4ZfpTSNiKxSBNrIP0NdfDbAR54pK4buivDX19Z3n+M=----ATTACHMENT:----MTgxMTcwNDg0NjI1MDA4MCAyOTg4MDE2NTQ5ODM1MDY1IDQ2MDMyNjM3OTQ2MDA0ODY=