@@ -51,16 +51,18 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 [ |