@@ -93,8 +93,9 @@ |
||
| 93 | 93 | $result = false; |
| 94 | 94 | $constants = $this->validPeriods(); |
| 95 | 95 | $values = array_values($constants); |
| 96 | - if(in_array($period, $values)) |
|
| 97 | - $result = true; |
|
| 96 | + if(in_array($period, $values)) { |
|
| 97 | + $result = true; |
|
| 98 | + } |
|
| 98 | 99 | return $result; |
| 99 | 100 | } |
| 100 | 101 | |
@@ -91,8 +91,9 @@ discard block |
||
| 91 | 91 | $this->driver = config($this->index . '.driver'); |
| 92 | 92 | |
| 93 | 93 | //TODO: REFACTOR for multiple storage types. |
| 94 | - if($this->driver != 'quota.storage.file') |
|
| 95 | - throw new \Exception('Driver: ' . $this->driver . ' not supported.'); |
|
| 94 | + if($this->driver != 'quota.storage.file') { |
|
| 95 | + throw new \Exception('Driver: ' . $this->driver . ' not supported.'); |
|
| 96 | + } |
|
| 96 | 97 | |
| 97 | 98 | $this->path = config($this->index . '.path'); |
| 98 | 99 | $this->storage = app($this->driver, ['path' => $this->path]); |
@@ -180,12 +181,12 @@ discard block |
||
| 180 | 181 | if (! isset($this->blocker)) |
| 181 | 182 | { |
| 182 | 183 | $result = $this->bucket->consume($tokens, $seconds); |
| 183 | - if( $result === false) |
|
| 184 | - throw new \ErrorException( |
|
| 184 | + if( $result === false) { |
|
| 185 | + throw new \ErrorException( |
|
| 185 | 186 | __CLASS__ . '::' . __FUNCTION__ . |
| 186 | 187 | ' Overquota. Exceeded bandwidth. Wait ' . $seconds . ' seconds.'); |
| 187 | - } |
|
| 188 | - else |
|
| 188 | + } |
|
| 189 | + } else |
|
| 189 | 190 | { |
| 190 | 191 | $result = $this->blocker->consume($tokens); |
| 191 | 192 | } |
@@ -203,14 +204,17 @@ discard block |
||
| 203 | 204 | */ |
| 204 | 205 | public function release() |
| 205 | 206 | { |
| 206 | - if (isset($this->blocker)) |
|
| 207 | - unset($this->blocker); |
|
| 207 | + if (isset($this->blocker)) { |
|
| 208 | + unset($this->blocker); |
|
| 209 | + } |
|
| 208 | 210 | |
| 209 | - if (isset($this->bucket)) |
|
| 210 | - unset($this->bucket); |
|
| 211 | + if (isset($this->bucket)) { |
|
| 212 | + unset($this->bucket); |
|
| 213 | + } |
|
| 211 | 214 | |
| 212 | - if (isset($this->rate)) |
|
| 213 | - unset($this->rate); |
|
| 215 | + if (isset($this->rate)) { |
|
| 216 | + unset($this->rate); |
|
| 217 | + } |
|
| 214 | 218 | } |
| 215 | 219 | |
| 216 | 220 | /** |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | (new $migrationClass)->up(); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - }else{
|
|
| 61 | + } else{
|
|
| 62 | 62 | |
| 63 | 63 | \Log::info($fileSystem->files($this->migrations_path)); |
| 64 | 64 | |
@@ -58,8 +58,9 @@ discard block |
||
| 58 | 58 | $this->index = 'quota.connections.' . $connection; |
| 59 | 59 | |
| 60 | 60 | $this->timezone = config($this->index . '.timezone'); |
| 61 | - if(is_null($this->timezone)) |
|
| 62 | - $this->timezone = config('quota.default_timezone'); |
|
| 61 | + if(is_null($this->timezone)) { |
|
| 62 | + $this->timezone = config('quota.default_timezone'); |
|
| 63 | + } |
|
| 63 | 64 | |
| 64 | 65 | $this->log_table = config($this->index . '.log_table'); |
| 65 | 66 | |
@@ -74,11 +75,12 @@ discard block |
||
| 74 | 75 | ' AND connection = ' . '\'' . $connection . '\'' |
| 75 | 76 | ); |
| 76 | 77 | |
| 77 | - if(empty($log_records)) |
|
| 78 | - \Artisan::call('quota:reset', [ |
|
| 78 | + if(empty($log_records)) { |
|
| 79 | + \Artisan::call('quota:reset', [ |
|
| 79 | 80 | 'date' => $date, |
| 80 | 81 | 'connection' => $connection |
| 81 | 82 | ]); |
| 83 | + } |
|
| 82 | 84 | } |
| 83 | 85 | |
| 84 | 86 | public function enforce() |
@@ -163,8 +165,7 @@ discard block |
||
| 163 | 165 | throw new \ErrorException( |
| 164 | 166 | __CLASS__ . '::' . __FUNCTION__ . |
| 165 | 167 | ' Overquota. Exceeded daily limit: ' . $this->limit); |
| 166 | - } |
|
| 167 | - else |
|
| 168 | + } else |
|
| 168 | 169 | { |
| 169 | 170 | $this->hit($stats->hits); |
| 170 | 171 | $result = true; |