@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @param string $key |
| 33 | 33 | * @param int $maxAttempts |
| 34 | - * @param float|int $decayMinutes |
|
| 34 | + * @param integer $decayMinutes |
|
| 35 | 35 | * |
| 36 | 36 | * @return bool |
| 37 | 37 | */ |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * Increment the counter for a given key for a given decay time. |
| 72 | 72 | * |
| 73 | 73 | * @param string $key |
| 74 | - * @param float|int $decayMinutes |
|
| 74 | + * @param integer $decayMinutes |
|
| 75 | 75 | * |
| 76 | 76 | * @return int |
| 77 | 77 | */ |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @param string $key |
| 101 | 101 | * |
| 102 | - * @return mixed |
|
| 102 | + * @return boolean |
|
| 103 | 103 | */ |
| 104 | 104 | public function resetAttempts($key) |
| 105 | 105 | { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function tooManyAttempts($key, $maxAttempts, $decayMinutes = 1) |
| 39 | 39 | { |
| 40 | - if ($this->cache->has($key.':lockout')) { |
|
| 40 | + if ($this->cache->has($key . ':lockout')) { |
|
| 41 | 41 | return true; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | protected function lockout($key, $decayMinutes) |
| 64 | 64 | { |
| 65 | 65 | $this->cache->add( |
| 66 | - $key.':lockout', Carbon::now()->getTimestamp() + ($decayMinutes * 60), $decayMinutes |
|
| 66 | + $key . ':lockout', Carbon::now()->getTimestamp() + ($decayMinutes * 60), $decayMinutes |
|
| 67 | 67 | ); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $this->resetAttempts($key); |
| 134 | 134 | |
| 135 | - $this->cache->forget($key.':lockout'); |
|
| 135 | + $this->cache->forget($key . ':lockout'); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -144,6 +144,6 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function availableIn($key) |
| 146 | 146 | { |
| 147 | - return $this->cache->get($key.':lockout') - Carbon::now()->getTimestamp(); |
|
| 147 | + return $this->cache->get($key . ':lockout') - Carbon::now()->getTimestamp(); |
|
| 148 | 148 | } |
| 149 | 149 | } |
@@ -35,9 +35,9 @@ |
||
| 35 | 35 | * @param \Illuminate\Http\Request $request |
| 36 | 36 | * @param \Closure $next |
| 37 | 37 | * @param int $maxAttempts |
| 38 | - * @param float|int $decayMinutes |
|
| 38 | + * @param integer $decayMinutes |
|
| 39 | 39 | * |
| 40 | - * @return mixed |
|
| 40 | + * @return Response |
|
| 41 | 41 | */ |
| 42 | 42 | public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes = 1) |
| 43 | 43 | { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | protected function resolveRequestSignature($request) |
| 68 | 68 | { |
| 69 | - if (! $route = $request->route()) { |
|
| 69 | + if (!$route = $request->route()) { |
|
| 70 | 70 | throw new RuntimeException('Unable to generate fingerprint. Route unavailable.'); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | 'X-RateLimit-Remaining' => $remainingAttempts, |
| 114 | 114 | ]; |
| 115 | 115 | |
| 116 | - if (! is_null($retryAfter)) { |
|
| 116 | + if (!is_null($retryAfter)) { |
|
| 117 | 117 | $headers['Retry-After'] = $retryAfter; |
| 118 | 118 | $headers['X-RateLimit-Reset'] = Carbon::now()->getTimestamp() + $retryAfter; |
| 119 | 119 | } |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | parent::fire(); |
| 54 | 54 | |
| 55 | 55 | $routeExists = Route::has( |
| 56 | - 'api.v1.'.$this->vars['lower_controller'].'.index' |
|
| 56 | + 'api.v1.' . $this->vars['lower_controller'] . '.index' |
|
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | - if (! $routeExists) { |
|
| 59 | + if (!$routeExists) { |
|
| 60 | 60 | $this->addRoute(); |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $stubName = 'api/route.stub'; |
| 84 | 84 | |
| 85 | - $sourceFile = $this->getSourcePath().'/'.$stubName; |
|
| 86 | - $destinationFile = $this->getDestinationPath().'/routes.php'; |
|
| 85 | + $sourceFile = $this->getSourcePath() . '/' . $stubName; |
|
| 86 | + $destinationFile = $this->getDestinationPath() . '/routes.php'; |
|
| 87 | 87 | $destinationContent = $this->files->get($sourceFile); |
| 88 | 88 | |
| 89 | 89 | /* |
| 90 | 90 | * Parse each variable in to the destination content and path |
| 91 | 91 | */ |
| 92 | 92 | foreach ($this->vars as $key => $var) { |
| 93 | - $destinationContent = str_replace('{{'.$key.'}}', $var, $destinationContent); |
|
| 94 | - $destinationFile = str_replace('{{'.$key.'}}', $var, $destinationFile); |
|
| 93 | + $destinationContent = str_replace('{{' . $key . '}}', $var, $destinationContent); |
|
| 94 | + $destinationFile = str_replace('{{' . $key . '}}', $var, $destinationFile); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $this->saveResource($destinationFile, $destinationContent); |
@@ -111,13 +111,13 @@ discard block |
||
| 111 | 111 | $author = array_pop($parts); |
| 112 | 112 | |
| 113 | 113 | $model = $this->argument('model'); |
| 114 | - $transformer = $model.'Transformer'; |
|
| 114 | + $transformer = $model . 'Transformer'; |
|
| 115 | 115 | |
| 116 | 116 | /* |
| 117 | 117 | * Determine the controller name to use. |
| 118 | 118 | */ |
| 119 | 119 | $controller = $this->option('controller'); |
| 120 | - if (! $controller) { |
|
| 120 | + if (!$controller) { |
|
| 121 | 121 | $controller = Str::plural($model); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | // modify file |
| 172 | 172 | if (strcmp($lastLine, '});') === 0) { |
| 173 | - $lines[count($lines) - 1] = ' '.$destinationContent; |
|
| 173 | + $lines[count($lines) - 1] = ' ' . $destinationContent; |
|
| 174 | 174 | $lines[] = "\r\n});\r\n"; |
| 175 | 175 | } else { |
| 176 | 176 | $lines[] = "$destinationContent\r\n"; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | $data = $this->request->json()->get($this->resourceKeySingular); |
| 159 | 159 | |
| 160 | - if (! $data) { |
|
| 160 | + if (!$data) { |
|
| 161 | 161 | return $this->errorWrongArgs('Empty data'); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $with = $this->getEagerLoad(); |
| 187 | 187 | |
| 188 | 188 | $item = $this->findItem($id, $with); |
| 189 | - if (! $item) { |
|
| 189 | + if (!$item) { |
|
| 190 | 190 | return $this->errorNotFound(); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -205,12 +205,12 @@ discard block |
||
| 205 | 205 | { |
| 206 | 206 | $data = $this->request->json()->get($this->resourceKeySingular); |
| 207 | 207 | |
| 208 | - if (! $data) { |
|
| 208 | + if (!$data) { |
|
| 209 | 209 | return $this->errorWrongArgs('Empty data'); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $item = $this->findItem($id); |
| 213 | - if (! $item) { |
|
| 213 | + if (!$item) { |
|
| 214 | 214 | return $this->errorNotFound(); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | { |
| 240 | 240 | $item = $this->findItem($id); |
| 241 | 241 | |
| 242 | - if (! $item) { |
|
| 242 | + if (!$item) { |
|
| 243 | 243 | return $this->errorNotFound(); |
| 244 | 244 | } |
| 245 | 245 | |