Passed
Branch master (664440)
by Musa
01:47
created
src/AutoPolicyProvider.php 1 patch
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,16 +51,18 @@  discard block
 block discarded – undo
51 51
             $data = $this->getPolicyData($policy);
52 52
 
53 53
             // Check if the model is not being used as a duplicate
54
-            if(isset($map[$data['model']]))
55
-                throw new Exception('The model "' . $data['model'] . '" is being used for more than one policy."');
54
+            if(isset($map[$data['model']])) {
55
+                            throw new Exception('The model "' . $data['model'] . '" is being used for more than one policy."');
56
+            }
56 57
 
57 58
             // Assign the policy its spot in the policy map
58 59
             $map[$data['model']] = $data['policy'];
59 60
         }
60 61
 
61 62
         // Cache the map and return it
62
-        if(!App::isLocal())
63
-            Cache::put(self::CACHE_KEY, $map, self::CACHE_TIME);
63
+        if(!App::isLocal()) {
64
+                    Cache::put(self::CACHE_KEY, $map, self::CACHE_TIME);
65
+        }
64 66
 
65 67
         return $map;
66 68
     }
@@ -74,15 +76,17 @@  discard block
 block discarded – undo
74 76
         $path = app_path('Policies');
75 77
 
76 78
         // Return an empty array if there are no policies at all
77
-        if(!file_exists($path))
78
-            return [];
79
+        if(!file_exists($path)) {
80
+                    return [];
81
+        }
79 82
 
80 83
         // Scan for policies
81 84
         $policies = scandir($path);
82 85
 
83 86
         // Remove hidden items
84
-        foreach ($policies as $key => $policy)
85
-            if(starts_with($policy, '.')) unset($policies[$key]);
87
+        foreach ($policies as $key => $policy) {
88
+                    if(starts_with($policy, '.')) unset($policies[$key]);
89
+        }
86 90
 
87 91
         return $policies;
88 92
     }
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
         // Attempt to get the model
108 112
         $model = $reflection->getConstant('MODEL');
109 113
 
110
-        if(!$model) throw new Exception('The policy "' . $policyClassName . '" is not bound to any model.');
114
+        if(!$model) {
115
+            throw new Exception('The policy "' . $policyClassName . '" is not bound to any model.');
116
+        }
111 117
 
112 118
         // Return the policy data
113 119
         return [
Please login to merge, or discard this patch.