@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function handle(Request $request, Closure $next) |
| 22 | 22 | { |
| 23 | 23 | // Next unless method is PATCH and If-Match header is set |
| 24 | - if (! ($request->isMethod('PATCH') && $request->hasHeader('If-Match'))) { |
|
| 24 | + if (!($request->isMethod('PATCH') && $request->hasHeader('If-Match'))) { |
|
| 25 | 25 | return $next($request); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -36,17 +36,16 @@ discard block |
||
| 36 | 36 | $getEtag = EtagConditionals::getEtag($request, $getResponse); |
| 37 | 37 | $ifMatch = $request->header('If-Match'); |
| 38 | 38 | |
| 39 | - if($ifMatch === null){ |
|
| 39 | + if ($ifMatch === null) { |
|
| 40 | 40 | return response(null, 412); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $ifMatchArray = (is_string($ifMatch))? |
|
| 44 | - explode(',', $ifMatch): |
|
| 45 | - $ifMatch; |
|
| 43 | + $ifMatchArray = (is_string($ifMatch)) ? |
|
| 44 | + explode(',', $ifMatch) : $ifMatch; |
|
| 46 | 45 | |
| 47 | 46 | // Strip W/ if weak comparison algorithm can be used |
| 48 | 47 | if (config('etagconditionals.if_match_weak')) { |
| 49 | - foreach($ifMatchArray as &$match){ |
|
| 48 | + foreach ($ifMatchArray as &$match) { |
|
| 50 | 49 | $match = str_replace('W/', '', $match); |
| 51 | 50 | } |
| 52 | 51 | unset($match); |
@@ -59,7 +58,7 @@ discard block |
||
| 59 | 58 | |
| 60 | 59 | // Compare current and request hashes |
| 61 | 60 | // Also allow wildcard (*) values |
| 62 | - if (! (in_array($getEtag, $ifMatchArray) || in_array('"*"', $ifMatchArray))) { |
|
| 61 | + if (!(in_array($getEtag, $ifMatchArray) || in_array('"*"', $ifMatchArray))) { |
|
| 63 | 62 | return response(null, 412); |
| 64 | 63 | } |
| 65 | 64 | |