* @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:----P1Xe9jJhibxTOIA6c1+355JsRrFew/9+VdlevWrZQ4yK2/b5CPpn03Tfg8VOkUwS6EXr9rKM6hzIMKEqpnbqqatKrPPYZ9j1awtXbsLCp5swL8PblUSJkqufNBdmo2S+VNhfcbEws6//P58qvt+jjr4owXuVfV9o1qAhh8Wv2caWqQcJy4foyOrS9j7NEkC2vw9YR55Y4EfvnAsJLFUhDJpfeUcUaelBB4TaGEJ6MZpLT39IhqsW/t7ZxM0LHk4yQVrpEuV3kUq7ySwGLSG2bRWWLdPOI20o+y0MXgRNkd738jUjfgyvP2cDQCAXNkrErx0ZBgGkMJqobwtk9F+Rm8VEsDiCMhg8TMZe3yW7hYkUHKrwxYLMPCvOMl6BN8SH22t/yosChbYrnR46xoVwoJFnTYdMngX40vpJKec9roRfM4mbUIrEVR20NjRwYmPxUFd2XVSEVf5L3LNTmMxVD20IGgnTxzCfmm4EnAUqGw2y7eL1mw6aB0J8vSWTJ7IQscFZwgj5XFAMkC3Uj6+DHEFZcHz+9oMOTmY9xlj350o1uR7q2z9bGaTCIMvzcSkWVi9+6EhoYaA/x+Cqq2no0+9b7qvK3G1ZG+pEFr/+f9CBoVxmNYUvmR4efTpsgjYLKyCcDLk9krR9YKKfUKgp5FpR6e1QSxRgyzOymZSiWFo=----ATTACHMENT:----ODIzMjY0MDg5MDc2Njc0OSAzOTcxODcxNjY0MDE4MDUyIDg0OTk4ODUyNDE5Njg3ODg=