From 02fe5a7f9ec2eef407301af69e8feb88994cc315 Mon Sep 17 00:00:00 2001
From: Jaeger <JaegerCode@gmail.com>
Date: Thu, 21 Sep 2017 01:44:03 +0800
Subject: [PATCH] ok

---
 composer.json     |  7 +++++--
 src/QueryList.php | 12 +++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/composer.json b/composer.json
index ea31eb9..9f248ae 100644
--- a/composer.json
+++ b/composer.json
@@ -4,9 +4,9 @@
     "keywords":["QueryList","phpQuery","spider"],
     "homepage": "http://querylist.cc",
     "require": {
-        "PHP":">=5.6.0",
+        "PHP":">=7.0",
         "jaeger/phpquery-single": "^0.9",
-        "illuminate/support": "^5.5"
+        "tightenco/collect": "^5.5"
     },
     "suggest":{
     	"monolog/monolog":"Log support"
@@ -22,5 +22,8 @@
         "psr-4":{
             "QL\\":"src"
         }
+    },
+    "require-dev": {
+        "symfony/var-dumper": "^3.3"
     }
 }
diff --git a/src/QueryList.php b/src/QueryList.php
index c543bf1..5ac626d 100644
--- a/src/QueryList.php
+++ b/src/QueryList.php
@@ -21,6 +21,7 @@ class QueryList
     protected $document;
     protected $rules;
     protected $range = null;
+    protected $encoder;
 
     /**
      * QueryList constructor.
@@ -88,10 +89,9 @@ class QueryList
             $robj = pq($document)->find($this->range);
             $i = 0;
             foreach ($robj as $item) {
-                while (list($key, $reg_value) = each($this->rules)) {
-                    $tags = isset($reg_value[2])?$reg_value[2]:'';
+                foreach ($this->rules as $key => $reg_value){
+                    $tags = $reg_value[2] ?? '';
                     $iobj = pq($item)->find($reg_value[0]);
-
                     switch ($reg_value[1]) {
                         case 'text':
                             $data[$i][$key] = $this->allowTags(pq($iobj)->html(),$tags);
@@ -108,13 +108,11 @@ class QueryList
                         $data[$i][$key] = call_user_func($reg_value[3],$data[$i][$key],$key);
                     }
                 }
-                //重置数组指针
-                reset($this->rules);
                 $i++;
             }
         } else {
-            while (list($key, $reg_value) = each($this->rules)) {
-                $tags = isset($reg_value[2])?$reg_value[2]:'';
+            foreach ($this->rules as $key => $reg_value){
+                $tags = $reg_value[2] ?? '';
                 $lobj = pq($document)->find($reg_value[0]);
                 $i = 0;
                 foreach ($lobj as $item) {