@@ -77,7 +77,7 @@ |
||
| 77 | 77 | */ |
| 78 | 78 | public static function create(callable $factory) |
| 79 | 79 | { |
| 80 | - return function (RequestInterface $request, ResponseInterface $response, callable $next) use ($factory) { |
|
| 80 | + return function(RequestInterface $request, ResponseInterface $response, callable $next) use ($factory) { |
|
| 81 | 81 | $middleware = $factory(); |
| 82 | 82 | |
| 83 | 83 | if ($middleware === false) { |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | $token = self::encode(hash_hmac('sha256', ClientIp::getIp($request), base64_decode($token), true)); |
| 134 | 134 | |
| 135 | 135 | return '<input type="hidden" name="'.$this->formIndex.'" value="'.htmlentities($index, ENT_QUOTES, 'UTF-8').'">' |
| 136 | - .'<input type="hidden" name="'.$this->formToken.'" value="'.htmlentities($token, ENT_QUOTES, 'UTF-8').'">'; |
|
| 136 | + .'<input type="hidden" name="'.$this->formToken.'" value="'.htmlentities($token, ENT_QUOTES, 'UTF-8').'">'; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | return $next($request, $response); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $tokens =& self::getStorage($request, self::KEY); |
|
| 73 | + $tokens = & self::getStorage($request, self::KEY); |
|
| 74 | 74 | |
| 75 | 75 | if (Utils\Helpers::isPost($request) && !$this->validateRequest($request, $tokens)) { |
| 76 | 76 | return $response->withStatus(403); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $generator = function ($action = null) use ($request, &$tokens) { |
|
| 79 | + $generator = function($action = null) use ($request, &$tokens) { |
|
| 80 | 80 | if (empty($action)) { |
| 81 | 81 | $action = $request->getUri()->getPath(); |
| 82 | 82 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $response = $next($request, $response); |
| 93 | 93 | |
| 94 | - $response = $this->insertIntoPostForms($response, function ($match) use ($generator) { |
|
| 94 | + $response = $this->insertIntoPostForms($response, function($match) use ($generator) { |
|
| 95 | 95 | preg_match('/action=["\']?([^"\'\s]+)["\']?/i', $match[0], $matches); |
| 96 | 96 | |
| 97 | 97 | return $match[0].$generator(isset($matches[1]) ? $matches[1] : null); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | return; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - uasort($tokens, function ($a, $b) { |
|
| 179 | + uasort($tokens, function($a, $b) { |
|
| 180 | 180 | return $a['created'] - $b['created']; |
| 181 | 181 | }); |
| 182 | 182 | |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | $path = $this->getPath($uri->getPath()); |
| 92 | 92 | $request = $request->withUri($uri->withPath($path)); |
| 93 | 93 | |
| 94 | - $generator = function ($path) { |
|
| 94 | + $generator = function($path) { |
|
| 95 | 95 | return Utils\Helpers::joinPath($this->basePath, $path); |
| 96 | 96 | }; |
| 97 | 97 | |
@@ -113,13 +113,13 @@ |
||
| 113 | 113 | |
| 114 | 114 | $value = $this->encrypt(time()); |
| 115 | 115 | |
| 116 | - $generator = function () use ($value) { |
|
| 116 | + $generator = function() use ($value) { |
|
| 117 | 117 | return '<input type="hidden" name="'.$this->inputName.'" value="'.$value.'">'; |
| 118 | 118 | }; |
| 119 | 119 | |
| 120 | 120 | $response = $next($request, $response); |
| 121 | 121 | |
| 122 | - return $this->insertIntoPostForms($response, function ($match) use ($generator) { |
|
| 122 | + return $this->insertIntoPostForms($response, function($match) use ($generator) { |
|
| 123 | 123 | return $match[0].$generator(); |
| 124 | 124 | }); |
| 125 | 125 | } |
@@ -90,13 +90,13 @@ |
||
| 90 | 90 | return $response->withStatus(403); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $generator = function () { |
|
| 93 | + $generator = function() { |
|
| 94 | 94 | return '<input type="text" name="'.$this->inputName.'" class="'.$this->inputClass.'">'; |
| 95 | 95 | }; |
| 96 | 96 | |
| 97 | 97 | $response = $next($request, $response); |
| 98 | 98 | |
| 99 | - return $this->insertIntoPostForms($response, function ($match) use ($generator) { |
|
| 99 | + return $this->insertIntoPostForms($response, function($match) use ($generator) { |
|
| 100 | 100 | return $match[0].$generator(); |
| 101 | 101 | }); |
| 102 | 102 | } |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | return $response; |
| 149 | 149 | |
| 150 | 150 | case 'html': |
| 151 | - $generator = function ($path, $transform) { |
|
| 151 | + $generator = function($path, $transform) { |
|
| 152 | 152 | $info = pathinfo($path); |
| 153 | 153 | |
| 154 | 154 | if (!isset($this->sizes[$transform])) { |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | if ($ip !== null) { |
| 93 | 93 | if ($this->saveInSession) { |
| 94 | - $ips =& self::getStorage($request, self::KEY); |
|
| 94 | + $ips = & self::getStorage($request, self::KEY); |
|
| 95 | 95 | |
| 96 | 96 | if (isset($ips[$ip])) { |
| 97 | 97 | $address = new AddressCollection($ips[$ip]); |