Explorar o código

Make the shouldSkipProperty code more readable

Christian Stocker %!s(int64=13) %!d(string=hai) anos
pai
achega
0ce7d3bf27
Modificáronse 1 ficheiros con 9 adicións e 5 borrados
  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)
     {
-        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;
     }
 }