Completed
Push — master ( ddf6ae...f02107 )
by Michał
05:59
created
src/auth/id/protocols/oauth1/middlewares/Authorization.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
      * See the class description for which kind of additional options are supported/mandatory.
105 105
      *
106 106
      * @param   callable    $handler
107
-     * @return  callable
107
+     * @return  \Closure
108 108
      */
109 109
     public function __invoke(callable $handler) : callable
110 110
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function setMethod(string $method) : Authorization
91 91
     {
92
-        switch($method) {
92
+        switch ($method) {
93 93
             case self::METHOD_HEADER:
94 94
             case self::METHOD_QUERY:
95 95
                 $this->method = $method;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function __invoke(callable $handler) : callable
110 110
     {
111
-        return function ($request, array& $stackOptions) use ($handler) {
111
+        return function($request, array& $stackOptions) use ($handler) {
112 112
 
113 113
             // Skip to the next handler if we weren't asked to do any stuff.
114 114
             if (!isset($stackOptions['oauth1'])) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             // so we might just as well make all the parameters we gather and append more easily accessible
120 120
             // by pushing into the $stackOptions directly in case there actually *are* handlers in the stack
121 121
             // that have to do some post-processing after us.
122
-            $handlerOptions =& $stackOptions['oauth1'] ?: $stackOptions['oauth1'] = [];
122
+            $handlerOptions = & $stackOptions['oauth1'] ?: $stackOptions['oauth1'] = [];
123 123
 
124 124
             $this->parseOptions($handlerOptions);
125 125
             $this->gatherAuthorizationParams($handlerOptions);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         // Unite our base parameters (which cannot be overridden) with the optional ones passed in.
188 188
         $options['params'] = [
189 189
             'oauth_version'          => '1.0',
190
-            'oauth_consumer_key'     => isset($options['client']) ? $options['client']->getId()     : $this->client->getId(),
190
+            'oauth_consumer_key'     => isset($options['client']) ? $options['client']->getId() : $this->client->getId(),
191 191
             'oauth_signature_method' => isset($options['signer']) ? $options['signer']->getMethod() : $this->signer->getMethod(),
192 192
             'oauth_nonce'            => utils\Random::string(6, utils\str\Character::CHARS_BASE64, utils\Random::STRENGTH_NONE),
193 193
             'oauth_timestamp'        => time(),
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
             $params[$key] = $key.'="'.rawurlencode($value).'"';
252 252
         }
253 253
 
254
-        return $request->withHeader('Authorization', 'OAuth ' . implode(', ', $params));
254
+        return $request->withHeader('Authorization', 'OAuth '.implode(', ', $params));
255 255
     }
256 256
 
257 257
     /**
Please login to merge, or discard this patch.
src/notify/transports/mail/drivers/Postmark.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@
 block discarded – undo
158 158
     /**
159 159
      * Converts an array of e-mail addresses into a string compliant with Postmark's API's format.
160 160
      *
161
-     * @param   array   $emails     The e-mail addresses to convert.
161
+     * @param   string[]   $emails     The e-mail addresses to convert.
162 162
      * @return  string
163 163
      */
164 164
     protected function emailsToString(array $emails) : string
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function send(\Swift_Mime_Message $message, &$failures = null)
48 48
     {
49
-        $this->client->request('POST','https://api.postmarkapp.com/email', [
49
+        $this->client->request('POST', 'https://api.postmarkapp.com/email', [
50 50
             'headers' => [
51 51
                 'X-Postmark-Server-Token' => $this->key
52 52
             ],
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
                 // Special treatment for the 'X-PM-Tag' header if it's available, which we'll pass into the payload
104 104
                 // directly.
105
-                if ($fieldName === 'X-PM-Tag'){
105
+                if ($fieldName === 'X-PM-Tag') {
106 106
                     $payload["Tag"] = $header->getValue();
107 107
                 } else {
108 108
                     $payload['Headers'][] = [
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $addresses = [];
167 167
 
168 168
         foreach ($emails as $email => $name) {
169
-            $addresses[] = $name ? '"' . str_replace('"', '\\"', $name) . "\" <{$email}>" : $email;
169
+            $addresses[] = $name ? '"'.str_replace('"', '\\"', $name)."\" <{$email}>" : $email;
170 170
         }
171 171
 
172 172
         return implode(',', $addresses);
Please login to merge, or discard this patch.
src/notify/transports/mail/drivers/Sendgrid.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * Parses the first and only the first address from the given array of e-mail addresses into a structure
153 153
      * understood by Sendgrid's API.
154 154
      *
155
-     * @param   array   $addresses  The e-mail addresses to parse.
155
+     * @param   string[]   $addresses  The e-mail addresses to parse.
156 156
      * @return  array
157 157
      */
158 158
     protected function processFirstAddress(array $addresses) : array
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     /**
173 173
      * Parses the given array of e-mail addresses into a structure understood by Sendgrid's API.
174 174
      *
175
-     * @param   array   $addresses  The e-mail addresses to parse.
175
+     * @param   string[]   $addresses  The e-mail addresses to parse.
176 176
      * @return  array
177 177
      */
178 178
     protected function processAllAddresses(array $addresses) : array
Please login to merge, or discard this patch.
src/notify/transports/slack/Message.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -403,7 +403,7 @@
 block discarded – undo
403 403
     /**
404 404
      * Attempts to create a slack\Attachment instance based on the $attachment data given.
405 405
      *
406
-     * @param   mixed   $attachment
406
+     * @param   callable   $attachment
407 407
      * @return  mixed                   Either an instantiated slack\Attachment, or a passthrough of the input data.
408 408
      */
409 409
     protected function resolveAttachment($attachment)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
         }
106 106
 
107 107
         if (isset($attributes['attachments'])) {
108
-            foreach($attributes['attachments'] as $attachment) {
108
+            foreach ($attributes['attachments'] as $attachment) {
109 109
                 $this->attach($attachment);
110 110
             }
111 111
         }
Please login to merge, or discard this patch.
src/utils/math/bigint/Gmp.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
     /**
109 109
      * Constructs a new GMP BigInt instance.
110 110
      *
111
-     * @param   \GMP    $value  The GMP object holding the actual value.
111
+     * @param   resource    $value  The GMP object holding the actual value.
112 112
      */
113 113
     public function __construct(\GMP $value)
114 114
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 } else {
85 85
                     $matches[1] = '';
86 86
                 }
87
-                $number = str_pad(($matches[1] . $matches[2]), ($matches[3] + 1), '0', STR_PAD_RIGHT);
87
+                $number = str_pad(($matches[1].$matches[2]), ($matches[3] + 1), '0', STR_PAD_RIGHT);
88 88
             } else {
89 89
                 $base = 0;
90 90
             }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $hex = gmp_strval($decimal, 16);
276 276
 
277 277
         if (strlen($hex) & 1) {
278
-            $hex = '0' . $hex;
278
+            $hex = '0'.$hex;
279 279
         }
280 280
 
281 281
         // Pack the hexadecimals into a string and remove the nullbyte.
Please login to merge, or discard this patch.
src/utils/tests/FuncTest.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -414,6 +414,10 @@
 block discarded – undo
414 414
     }
415 415
 
416 416
     // Used by the when/unless tests.
417
+
418
+    /**
419
+     * @param boolean $exists
420
+     */
417 421
     protected function setWhenExists($exists)
418 422
     {
419 423
         $this->whenExists = (bool) $exists;
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $runs  = 11;
25 25
 
26 26
         // Let's create a simple helper.
27
-        $test = function (callable $wrapper, callable $function, $value) use ($times, $runs) {
27
+        $test = function(callable $wrapper, callable $function, $value) use ($times, $runs) {
28 28
 
29 29
             // Invoke the function once to determine the expected value.
30 30
             $expected = $function($value);
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
         };
40 40
 
41 41
         // Prepare our functions.
42
-        $func1 = function ($value) {return 'foo'.$value;};
43
-        $func2 = function ($value) {return $value.'bar';};
42
+        $func1 = function($value) {return 'foo'.$value; };
43
+        $func2 = function($value) {return $value.'bar'; };
44 44
 
45 45
         // Run a few loops.
46 46
         $wrapper = Func::after($times, $func1);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function testHash()
55 55
     {
56 56
         // Prepare our functions.
57
-        $func1 = function ($arg1, $arg2) {return true;};
57
+        $func1 = function($arg1, $arg2) {return true; };
58 58
 
59 59
         // Run some tests.
60 60
         $this->assertEquals('8bdb4ed5e8d60590121851789f7c5366', Func::hash($func1, ['arg1', 'arg2']));
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     public function testMemoize()
78 78
     {
79 79
         // Prepare our functions.
80
-        $func = function ($arg1, $arg2) {return $arg1.$arg2;};
80
+        $func = function($arg1, $arg2) {return $arg1.$arg2; };
81 81
 
82 82
         // Without resolver (automatic cache key).
83 83
         $memoized = Func::memoize($func);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $this->assertNotEquals('foobar', $memoized('bar', 'foo'));
89 89
 
90 90
         // With resolver (key depends on args).
91
-        $resolver = function (callable $func, $args) {
91
+        $resolver = function(callable $func, $args) {
92 92
             return 'key_'.$args[0].$args[1];
93 93
         };
94 94
         $memoized = Func::memoize($func, $resolver);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         // With resolver (fixed key) - all calls should return the first result, regardless of the arguments
102 102
         // passed, since the result will be fetched from the fixed key.
103
-        $resolver = function (callable $func, $args) {return 'key';};
103
+        $resolver = function(callable $func, $args) {return 'key'; };
104 104
         $memoized = Func::memoize($func, $resolver);
105 105
 
106 106
         $this->assertEquals('foobar', $memoized('foo', 'bar'));
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
     public function testOnce()
120 120
     {
121 121
         // Prepare our functions.
122
-        $func1 = function ($value) {return 'foo'.$value;};
123
-        $func2 = function ($value) {return $value.'bar';};
122
+        $func1 = function($value) {return 'foo'.$value; };
123
+        $func2 = function($value) {return $value.'bar'; };
124 124
 
125 125
         // Run some tests.
126 126
         $wrapper = Func::once($func1);
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
     public function testOnly()
139 139
     {
140 140
         // Prepare our functions.
141
-        $func1 = function ($value) {return 'foo'.$value;};
142
-        $func2 = function ($value) {return $value.'bar';};
141
+        $func1 = function($value) {return 'foo'.$value; };
142
+        $func2 = function($value) {return $value.'bar'; };
143 143
 
144 144
         // Run some tests.
145 145
         $wrapper = Func::only(3, $func1);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     public function testPartial()
161 161
     {
162 162
         // Prepare our function.
163
-        $func = function ($val1, $val2, $val3) {return $val1.$val2.$val3;};
163
+        $func = function($val1, $val2, $val3) {return $val1.$val2.$val3; };
164 164
 
165 165
         // Run some tests.
166 166
         $wrapper = Func::partial($func, 'foo', 'bar');
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     public function testPartialRight()
177 177
     {
178 178
         // Prepare our function.
179
-        $func = function ($val1, $val2, $val3) {return $val1.$val2.$val3;};
179
+        $func = function($val1, $val2, $val3) {return $val1.$val2.$val3; };
180 180
 
181 181
         // Run some tests.
182 182
         $wrapper = Func::partialRight($func, 'foo', 'bar');
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     public function testThrottle()
193 193
     {
194 194
         $counter  = 0;
195
-        $function = function () use (&$counter) { $counter++; };
195
+        $function = function() use (&$counter) { $counter++; };
196 196
         $wrapper  = Func::throttle($function, 100);
197 197
 
198 198
         // Time it to invoke the function 5 times at most, even though we call the wrapper 7 times.
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
         // Single call.
215 215
         $counter  = 0;
216
-        $function = function () use (&$counter) { $counter++; };
216
+        $function = function() use (&$counter) { $counter++; };
217 217
         $wrapper  = Func::throttle($function, 100);
218 218
 
219 219
         $wrapper();
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
         // Double call.
226 226
         $counter  = 0;
227
-        $function = function () use (&$counter) { $counter++; };
227
+        $function = function() use (&$counter) { $counter++; };
228 228
         $wrapper  = Func::throttle($function, 100);
229 229
 
230 230
         $wrapper();
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     public function testRetryAlwaysSuccessful()
242 242
     {
243 243
         $expected = 'foo';
244
-        $result   = Func::retry(function () use ($expected) {
244
+        $result   = Func::retry(function() use ($expected) {
245 245
             return $expected;
246 246
         });
247 247
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     {
253 253
         $this->expectException('InvalidArgumentException');
254 254
 
255
-        Func::retry(function () {
255
+        Func::retry(function() {
256 256
             throw new \InvalidArgumentException;
257 257
         });
258 258
     }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     public function testRetryWithSingleException()
261 261
     {
262 262
         $shouldThrow = true;
263
-        $result = Func::retry(function () use (&$shouldThrow) {
263
+        $result = Func::retry(function() use (&$shouldThrow) {
264 264
             if ($shouldThrow) {
265 265
                 $shouldThrow = false;
266 266
                 throw new \Exception;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     {
277 277
         $count = 0;
278 278
         try {
279
-            Func::retry(function () use (&$count) {
279
+            Func::retry(function() use (&$count) {
280 280
                 $count++;
281 281
                 throw new \Exception;
282 282
             }, 5);
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         $startTime = microtime(true);
292 292
 
293 293
         try {
294
-            Func::retry(function () use (&$count) {
294
+            Func::retry(function() use (&$count) {
295 295
                 throw new \Exception;
296 296
             }, 4, 0.25);
297 297
         } catch (\Exception $e) {
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
     public function testUnless()
309 309
     {
310 310
         // -- Basic test. No params for the test nor the callable.
311
-        $test = function () {
311
+        $test = function() {
312 312
             return true === $this->getWhenExists();
313 313
         };
314 314
 
315
-        $callable = function () {return 1;};
315
+        $callable = function() {return 1; };
316 316
 
317 317
         $unless = Func::unless($test, $callable);
318 318
         $this->setWhenExists(true);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $this->assertEquals(1, $unless());
322 322
 
323 323
         // -- Params for the callable.
324
-        $callable = function ($val) {return $val;};
324
+        $callable = function($val) {return $val; };
325 325
         $unless = Func::unless($test, $callable);
326 326
         $this->setWhenExists(true);
327 327
         $this->assertNull($unless('foo'));
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         $this->assertEquals('foo', $unless('foo'));
330 330
 
331 331
         // -- Same params for the callable and the test.
332
-        $test = function ($bool) {
332
+        $test = function($bool) {
333 333
             return $bool === $this->getWhenExists();
334 334
         };
335 335
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
         $this->assertTrue($unless(true));
343 343
 
344 344
         // -- Different params for the callable and the test.
345
-        $test = function ($bool) {
345
+        $test = function($bool) {
346 346
             return $bool === $this->getWhenExists();
347 347
         };
348 348
 
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
     public function testWhen()
361 361
     {
362 362
         // -- Basic test. No params for the test nor the callable.
363
-        $test = function () {
363
+        $test = function() {
364 364
             return true === $this->getWhenExists();
365 365
         };
366 366
 
367
-        $callable = function () {return 1;};
367
+        $callable = function() {return 1; };
368 368
         $when = Func::when($test, $callable);
369 369
         $this->setWhenExists(true);
370 370
         $this->assertEquals(1, $when());
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $this->assertNull($when());
373 373
 
374 374
         // -- Params for the callable.
375
-        $callable = function ($val) {return $val;};
375
+        $callable = function($val) {return $val; };
376 376
         $when = Func::when($test, $callable);
377 377
         $this->setWhenExists(true);
378 378
         $this->assertEquals('foo', $when('foo'));
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         $this->assertNull($when('foo'));
381 381
 
382 382
         // -- Same params for the callable and the test.
383
-        $test = function ($bool) {
383
+        $test = function($bool) {
384 384
             return $bool === $this->getWhenExists();
385 385
         };
386 386
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         $this->assertFalse($when(false));
394 394
 
395 395
         // -- Different params for the callable and the test.
396
-        $test = function ($bool) {
396
+        $test = function($bool) {
397 397
             return $bool === $this->getWhenExists();
398 398
         };
399 399
 
Please login to merge, or discard this patch.
src/notify/Service.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function register()
23 23
     {
24
-        $this->app->singleton(TransportManager::class, function (Application $app) {
24
+        $this->app->singleton(TransportManager::class, function(Application $app) {
25 25
             return new TransportManager($app);
26 26
         });
27 27
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     protected function registerMailer()
39 39
     {
40
-        $this->app->singleton('mailer', function (Application $app) {
40
+        $this->app->singleton('mailer', function(Application $app) {
41 41
 
42 42
             $mailer = new transports\mail\Mailer($app->make('mailer.transports')->driver(), $app->make('view'));
43 43
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         // We are going to need to instantiate the Mailer with a proper Driver.
62 62
         // @todo Drop the DriverManager in favour of handling the logic in this very Service Provider itself?
63
-        $this->app->singleton('mailer.transports', function (Application $app) {
63
+        $this->app->singleton('mailer.transports', function(Application $app) {
64 64
             return (new transports\mail\DriverManager($app));
65 65
         });
66 66
     }
Please login to merge, or discard this patch.
src/notify/transports/Slack.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@
 block discarded – undo
147 147
         $message['endpoint']     = $message['endpoint'] ?? $this->endpoint;
148 148
         $message['username']     = $message['username'] ?? $this->username;
149 149
         $message['parse']        = $message['parse']    ?? $this->parse;
150
-        $message['link_names']   = $this->linkNames     ? 1 : 0;
150
+        $message['link_names']   = $this->linkNames ? 1 : 0;
151 151
         $message['unfurl_links'] = $this->unfurlLinks;
152 152
         $message['unfurl_media'] = $this->unfurlMedia;
153 153
         $message['mrkdwn']       = $this->allowMarkdown;
Please login to merge, or discard this patch.
src/notify/transports/mail/drivers/Mailgun.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
                     'api', $this->key
74 74
                 ],
75 75
                 'multipart' => [
76
-                    ['name' => 'to',      'contents' => implode(',', $recipients)],
76
+                    ['name' => 'to', 'contents' => implode(',', $recipients)],
77 77
                     ['name' => 'message', 'contents' => $message->toString(), 'filename' => 'message.mime'],
78 78
                 ]
79 79
             ]);
Please login to merge, or discard this patch.