@@ -6,9 +6,7 @@ |
||
6 | 6 | use Psr7Middlewares\Utils; |
7 | 7 | use Psr\Http\Message\ServerRequestInterface; |
8 | 8 | use Psr\Http\Message\ResponseInterface; |
9 | -use InvalidArgumentException; |
|
10 | 9 | use RuntimeException; |
11 | -use ArrayAccess; |
|
12 | 10 | |
13 | 11 | /** |
14 | 12 | * Middleware for CSRF protection |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | return $response->withStatus(403); |
83 | 83 | } |
84 | 84 | |
85 | - $generator = function ($action) use ($request, &$tokens) { |
|
85 | + $generator = function($action) use ($request, &$tokens) { |
|
86 | 86 | return $this->generateTokens($request, $action, $tokens); |
87 | 87 | }; |
88 | 88 | |
89 | 89 | $response = $next($request, $response); |
90 | 90 | |
91 | - $response = $this->insertIntoPostForms($response, function ($match) use ($generator) { |
|
91 | + $response = $this->insertIntoPostForms($response, function($match) use ($generator) { |
|
92 | 92 | preg_match('/action=["\']?([^"\'\s]+)["\']?/i', $match[0], $matches); |
93 | 93 | |
94 | 94 | $action = empty($matches[1]) ? $request->getUri()->getPath() : $matches[1]; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - uasort($tokens, function ($a, $b) { |
|
182 | + uasort($tokens, function($a, $b) { |
|
183 | 183 | return $a['created'] - $b['created']; |
184 | 184 | }); |
185 | 185 |
@@ -109,7 +109,6 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * Returns the geolocation from the session storage |
111 | 111 | * |
112 | - * @param ResponseInterface $response |
|
113 | 112 | * @param string $ip |
114 | 113 | * |
115 | 114 | * @return AddressCollection|null |
@@ -127,7 +126,6 @@ discard block |
||
127 | 126 | /** |
128 | 127 | * Saves the geolocation in the session storage |
129 | 128 | * |
130 | - * @param ResponseInterface $response |
|
131 | 129 | * @param string $ip |
132 | 130 | * @param AddressCollection $address |
133 | 131 | */ |
@@ -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) use ($request) { |
|
151 | + $generator = function($path, $transform) use ($request) { |
|
152 | 152 | $info = pathinfo($path); |
153 | 153 | |
154 | 154 | if (!isset($this->sizes[$transform])) { |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $storage[Middleware::KEY] = []; |
18 | 18 | } |
19 | 19 | |
20 | - $this->storage =& $storage[Middleware::KEY]; |
|
20 | + $this->storage = & $storage[Middleware::KEY]; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |