Selaa lähdekoodia

Make the shouldSkipProperty code more readable

Christian Stocker 13 vuotta sitten
vanhempi
commit
0ce7d3bf27
1 muutettua tiedostoa jossa 9 lisäystä ja 5 poistoa
  1. 9 5
      Serializer/Exclusion/GroupsExclusionStrategy.php

+ 9 - 5
Serializer/Exclusion/GroupsExclusionStrategy.php

@@ -42,13 +42,17 @@ class GroupsExclusionStrategy implements ExclusionStrategyInterface
      */
      */
     public function shouldSkipProperty(PropertyMetadata $property)
     public function shouldSkipProperty(PropertyMetadata $property)
     {
     {
-        if ($this->groups && $property->groups) {
-            foreach ($property->groups as $group) {
-                if (isset($this->groups[$group])) {
-                    return false;
-                }
+        
+        if (!$property->groups) {
+            return true;
+        }
+
+        foreach ($property->groups as $group) {
+            if (isset($this->groups[$group])) {
+                return false;
             }
             }
         }
         }
+
         return true;
         return true;
     }
     }
 }
 }