stanley-king hace 8 años
padre
commit
e9c3b7bdba
Se han modificado 1 ficheros con 10 adiciones y 10 borrados
  1. 10 10
      helper/search/util.php

+ 10 - 10
helper/search/util.php

@@ -78,7 +78,7 @@ class words
 
     protected function add($key,$value)
     {
-        if(array_key_exists($key,$this->mDict))
+        if(isset($this->mDict[$key]))
         {
             $datas = &$this->mDict[$key];
             if(algorithm::binary_search($datas,$value) == false) {
@@ -92,7 +92,7 @@ class words
     }
     public function find($key)
     {
-        if(array_key_exists($key,$this->mDict)) {
+        if(isset($this->mDict[$key])) {
             return $this->mDict[$key];
         } else {
             return array();
@@ -101,7 +101,7 @@ class words
 
     public function name($val)
     {
-        if(array_key_exists($val,$this->mContainer)) {
+        if(isset($this->mContainer[$val])) {
             return $this->mContainer[$val];
         } else {
             return false;
@@ -119,7 +119,7 @@ class one_multi
 
     public function add($key,$val)
     {
-        if(array_key_exists($key,$this->mContainer))
+        if(isset($this->mContainer[$key]))
         {
             $values = &$this->mContainer[$key];
             if(algorithm::binary_search($values,$val) == false) {
@@ -135,7 +135,7 @@ class one_multi
 
     public function get($key)
     {
-        if(array_key_exists($key,$this->mContainer))
+        if(isset($this->mContainer[$key]))
         {
             return $this->mContainer[$key];
         }
@@ -160,7 +160,7 @@ class one_one
 
     public function get($key)
     {
-        if(array_key_exists($key,$this->mContainer))
+        if(isset($this->mContainer[$key]))
         {
             return $this->mContainer[$key];
         }
@@ -183,7 +183,7 @@ class array_tree
         $id = intval($id);
         $pid = intval($pid);
 
-        if(array_key_exists($pid,$this->mTree) == false) {
+        if(isset($this->mTree[$pid]) == false) {
             $this->mTree[$pid] = [];
             $this->mTree[$pid]['pid'] = 0;
             $this->mTree[$pid]['subids'] = [];
@@ -193,7 +193,7 @@ class array_tree
             $this->add_sub($sub_ids,$id);
         }
 
-        if(array_key_exists($id,$this->mTree) == false) {
+        if(isset($this->mTree[$id]) == false) {
             $this->mTree[$id] = [];
             $this->mTree[$id]['pid'] = $pid;
             $this->mTree[$id]['subids'] = [];
@@ -210,7 +210,7 @@ class array_tree
 
     public function is_parent($hot)
     {
-        if (array_key_exists($hot, $this->mTree) == false) {
+        if (isset($this->mTree[$hot]) == false) {
             return false;
         }
 
@@ -218,7 +218,7 @@ class array_tree
     }
     public function subs($hot)
     {
-        if (array_key_exists($hot, $this->mTree) == false) {
+        if (isset($this->mTree[$hot]) == false) {
             return array();
         }