@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | // Intercept the flow - instead of directly returning a Promise for the entity's identity data, |
| 61 | 61 | // we will now return a Promise that resolves once both the email and identity |
| 62 | 62 | // data have been resolved and the email has been mapped into the identity data. |
| 63 | - $promise = $this->getEmail($token)->then(function ($email) use ($token, $promise) { |
|
| 63 | + $promise = $this->getEmail($token)->then(function($email) use ($token, $promise) { |
|
| 64 | 64 | |
| 65 | 65 | // Map the email in once the identity data is available (has succesfully resolved). |
| 66 | - return $promise->then(function (array $data) use ($token, $email) { |
|
| 66 | + return $promise->then(function(array $data) use ($token, $email) { |
|
| 67 | 67 | |
| 68 | 68 | $data['email'] = $email ?? $data['email']; |
| 69 | 69 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | }); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return $promise->then(function (array $data) use ($token) { |
|
| 75 | + return $promise->then(function(array $data) use ($token) { |
|
| 76 | 76 | return $this->createIdentity($token, $data); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | // Intercept the flow - instead of directly returning a Promise for the entity's identity data, |
| 56 | 56 | // we will now return a Promise that resolves once both the email and identity |
| 57 | 57 | // data have been resolved and the email has been mapped into the identity data. |
| 58 | - $promise = $this->getEmail($token)->then(function ($email) use ($token, $promise) { |
|
| 58 | + $promise = $this->getEmail($token)->then(function($email) use ($token, $promise) { |
|
| 59 | 59 | |
| 60 | 60 | // Map the e-mail address in once the identity data is available (has successfully resolved). |
| 61 | - return $promise->then(function (array $data) use ($token, $email) { |
|
| 61 | + return $promise->then(function(array $data) use ($token, $email) { |
|
| 62 | 62 | |
| 63 | 63 | $data['email'] = $email ?? $data['email']; |
| 64 | 64 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | }); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - return $promise->then(function (array $data) use ($token) { |
|
| 70 | + return $promise->then(function(array $data) use ($token) { |
|
| 71 | 71 | return $this->createIdentity($token, $data); |
| 72 | 72 | }); |
| 73 | 73 | } |
@@ -38,9 +38,9 @@ |
||
| 38 | 38 | public function getIdentifyUrl() : string |
| 39 | 39 | { |
| 40 | 40 | $fields = [ |
| 41 | - 'id', 'first-name', 'last-name', 'formatted-name', |
|
| 42 | - 'email-address', 'headline', 'location', 'industry', |
|
| 43 | - 'public-profile-url', 'picture-url', |
|
| 41 | + 'id', 'first-name', 'last-name', 'formatted-name', |
|
| 42 | + 'email-address', 'headline', 'location', 'industry', |
|
| 43 | + 'public-profile-url', 'picture-url', |
|
| 44 | 44 | ]; |
| 45 | 45 | |
| 46 | 46 | // Talk about proprietary 'standards'... |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public function getDescription() : ?string |
|
| 63 | + public function getDescription() : ? string |
|
| 64 | 64 | { |
| 65 | 65 | return $this->description; |
| 66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | - public function getLocation() : ?string |
|
| 73 | + public function getLocation() : ? string |
|
| 74 | 74 | { |
| 75 | 75 | return $this->location; |
| 76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return int |
| 82 | 82 | */ |
| 83 | - public function getFollowersCount() : ?int |
|
| 83 | + public function getFollowersCount() : ? int |
|
| 84 | 84 | { |
| 85 | 85 | return $this->followersCount; |
| 86 | 86 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | * |
| 20 | 20 | * @return Emitter |
| 21 | 21 | */ |
| 22 | - public function getEmitter() : ?Emitter; |
|
| 22 | + public function getEmitter() : ? Emitter; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Sets the Event Emitter instance this object should have access to. |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | { |
| 76 | 76 | // We'll create a wrapper closure which will remove the listener once it receives the first event |
| 77 | 77 | // and forward the arguments from the wrapper to the actual listener. |
| 78 | - $wrapper = function (...$payload) use (&$wrapper, $event, $listener) { |
|
| 78 | + $wrapper = function(...$payload) use (&$wrapper, $event, $listener) { |
|
| 79 | 79 | $this->off($event, $wrapper); |
| 80 | 80 | |
| 81 | 81 | $listener(...$payload); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | /** |
| 25 | 25 | * @see \nyx\events\interfaces\EmitterAware::getEmitter() |
| 26 | 26 | */ |
| 27 | - public function getEmitter() : ?interfaces\Emitter |
|
| 27 | + public function getEmitter() : ? interfaces\Emitter |
|
| 28 | 28 | { |
| 29 | 29 | return $this->emitter; |
| 30 | 30 | } |
@@ -459,7 +459,7 @@ |
||
| 459 | 459 | |
| 460 | 460 | // Those may change, so... besides - fancy syntax, eh chaps? |
| 461 | 461 | $this->status->{((isset($this->metadata['seekable']) && $this->metadata['seekable']) ? 'set' : 'remove')}(interfaces\Stream::SEEKABLE); |
| 462 | - $this->status->{((isset($this->metadata['blocked']) && $this->metadata['blocked']) ? 'set' : 'remove')}(interfaces\Stream::BLOCKED); |
|
| 462 | + $this->status->{((isset($this->metadata['blocked']) && $this->metadata['blocked']) ? 'set' : 'remove')}(interfaces\Stream::BLOCKED); |
|
| 463 | 463 | |
| 464 | 464 | return true; |
| 465 | 465 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |