Esempio n. 1
0
 protected static function matchArray(\ArrayAccess $tag1, \ArrayAccess $tag2)
 {
     if ($tag1->getName() !== $tag2->getName() or $tag1->getCount() !== $tag2->getCount()) {
         return false;
     }
     foreach ($tag1 as $k => $v) {
         if (!$v instanceof Tag) {
             continue;
         }
         if (!isset($tag2->{$k}) or !$tag2->{$k} instanceof $v) {
             return false;
         }
         if ($v instanceof Compound) {
             if (!self::matchTree($v, $tag2->{$k})) {
                 return false;
             }
         } elseif ($v instanceof Enum) {
             if (!self::matchList($v, $tag2->{$k})) {
                 return false;
             }
         } else {
             if ($v->getValue() !== $tag2->{$k}->getValue()) {
                 return false;
             }
         }
     }
     return true;
 }