@@ -104,7 +104,7 @@ |
||
| 104 | 104 | /** |
| 105 | 105 | * @param integer $totalLength |
| 106 | 106 | * @param string $prefix |
| 107 | - * @return bool|string |
|
| 107 | + * @return string|false |
|
| 108 | 108 | */ |
| 109 | 109 | protected function getAvailableTicket($totalLength, $prefix) |
| 110 | 110 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @throws CasException |
| 52 | 52 | * @return \Leo108\CAS\Models\Ticket |
| 53 | 53 | */ |
| 54 | - public function applyTicket(UserModel $user, $serviceUrl, $proxies = []) |
|
| 54 | + public function applyTicket(UserModel $user, $serviceUrl, $proxies = [ ]) |
|
| 55 | 55 | { |
| 56 | 56 | $service = $this->serviceRepository->getServiceByUrl($serviceUrl); |
| 57 | 57 | if (!$service) { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | return $this->ticketGenerator->generate( |
| 112 | 112 | $totalLength, |
| 113 | 113 | $prefix, |
| 114 | - function ($ticket) { |
|
| 114 | + function($ticket) { |
|
| 115 | 115 | return $this->getByTicket($ticket, false); |
| 116 | 116 | }, |
| 117 | 117 | 10 |
@@ -936,6 +936,9 @@ |
||
| 936 | 936 | $method->invokeArgs($controller, [$code, $desc, 'XML']); |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | + /** |
|
| 940 | + * @param string $pgt |
|
| 941 | + */ |
|
| 939 | 942 | protected function getValidRequest($pgt = null) |
| 940 | 943 | { |
| 941 | 944 | $mock = Mockery::mock(Request::class) |
@@ -21,8 +21,6 @@ |
||
| 21 | 21 | use Leo108\CAS\Responses\XmlAuthenticationSuccessResponse; |
| 22 | 22 | use Leo108\CAS\Services\PGTCaller; |
| 23 | 23 | use Leo108\CAS\Services\TicketGenerator; |
| 24 | -use SerializableModel; |
|
| 25 | -use SimpleXMLElement; |
|
| 26 | 24 | use TestCase; |
| 27 | 25 | use Mockery; |
| 28 | 26 | use User; |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $request = Mockery::mock(Request::class) |
| 49 | 49 | ->shouldReceive('get') |
| 50 | - ->withArgs(['ticket', '']) |
|
| 50 | + ->withArgs([ 'ticket', '' ]) |
|
| 51 | 51 | ->andReturnNull() |
| 52 | 52 | ->shouldReceive('get') |
| 53 | - ->withArgs(['service', '']) |
|
| 53 | + ->withArgs([ 'service', '' ]) |
|
| 54 | 54 | ->andReturnNull() |
| 55 | 55 | ->getMock(); |
| 56 | - $resp = app()->make(ValidateController::class)->v1ValidateAction($request); |
|
| 56 | + $resp = app()->make(ValidateController::class)->v1ValidateAction($request); |
|
| 57 | 57 | $this->assertInstanceOf(Response::class, $resp); |
| 58 | 58 | $this->assertEquals('no', $resp->getOriginalContent()); |
| 59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | ->shouldReceive('lockTicket') |
| 68 | 68 | ->andReturn(false) |
| 69 | 69 | ->getMock(); |
| 70 | - $resp = $controller->v1ValidateAction($request); |
|
| 70 | + $resp = $controller->v1ValidateAction($request); |
|
| 71 | 71 | $this->assertInstanceOf(Response::class, $resp); |
| 72 | 72 | $this->assertEquals('no', $resp->getOriginalContent()); |
| 73 | 73 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ->andReturn(true) |
| 88 | 88 | ->shouldReceive('unlockTicket') |
| 89 | 89 | ->getMock(); |
| 90 | - $resp = $controller->v1ValidateAction($request); |
|
| 90 | + $resp = $controller->v1ValidateAction($request); |
|
| 91 | 91 | $this->assertInstanceOf(Response::class, $resp); |
| 92 | 92 | $this->assertEquals('no', $resp->getOriginalContent()); |
| 93 | 93 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | ->andReturn(true) |
| 110 | 110 | ->shouldReceive('unlockTicket') |
| 111 | 111 | ->getMock(); |
| 112 | - $resp = $controller->v1ValidateAction($request); |
|
| 112 | + $resp = $controller->v1ValidateAction($request); |
|
| 113 | 113 | $this->assertInstanceOf(Response::class, $resp); |
| 114 | 114 | $this->assertEquals('no', $resp->getOriginalContent()); |
| 115 | 115 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $request = $this->getValidRequest(); |
| 120 | 120 | $ticket = Mockery::mock(Ticket::class) |
| 121 | 121 | ->shouldReceive('getAttribute') |
| 122 | - ->withArgs(['service_url']) |
|
| 122 | + ->withArgs([ 'service_url' ]) |
|
| 123 | 123 | ->andReturn('http://leo108.com') |
| 124 | 124 | ->getMock(); |
| 125 | 125 | $ticketRepository = Mockery::mock(TicketRepository::class) |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | ->andReturn(true) |
| 136 | 136 | ->shouldReceive('unlockTicket') |
| 137 | 137 | ->getMock(); |
| 138 | - $resp = $controller->v1ValidateAction($request); |
|
| 138 | + $resp = $controller->v1ValidateAction($request); |
|
| 139 | 139 | $this->assertInstanceOf(Response::class, $resp); |
| 140 | 140 | $this->assertEquals('yes', $resp->getOriginalContent()); |
| 141 | 141 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | ->shouldAllowMockingProtectedMethods() |
| 148 | 148 | ->shouldReceive('casValidate') |
| 149 | 149 | ->andReturnUsing( |
| 150 | - function ($request, $returnAttr, $allowProxy) { |
|
| 150 | + function($request, $returnAttr, $allowProxy) { |
|
| 151 | 151 | $this->assertFalse($returnAttr); |
| 152 | 152 | $this->assertFalse($allowProxy); |
| 153 | 153 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | ) |
| 157 | 157 | ->once() |
| 158 | 158 | ->getMock(); |
| 159 | - $request = Mockery::mock(Request::class); |
|
| 159 | + $request = Mockery::mock(Request::class); |
|
| 160 | 160 | $this->assertEquals('casValidate called', $controller->v2ServiceValidateAction($request)); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | ->shouldAllowMockingProtectedMethods() |
| 168 | 168 | ->shouldReceive('casValidate') |
| 169 | 169 | ->andReturnUsing( |
| 170 | - function ($request, $returnAttr, $allowProxy) { |
|
| 170 | + function($request, $returnAttr, $allowProxy) { |
|
| 171 | 171 | $this->assertFalse($returnAttr); |
| 172 | 172 | $this->assertTrue($allowProxy); |
| 173 | 173 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | ) |
| 177 | 177 | ->once() |
| 178 | 178 | ->getMock(); |
| 179 | - $request = Mockery::mock(Request::class); |
|
| 179 | + $request = Mockery::mock(Request::class); |
|
| 180 | 180 | $this->assertEquals('casValidate called', $controller->v2ProxyValidateAction($request)); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | ->shouldAllowMockingProtectedMethods() |
| 188 | 188 | ->shouldReceive('casValidate') |
| 189 | 189 | ->andReturnUsing( |
| 190 | - function ($request, $returnAttr, $allowProxy) { |
|
| 190 | + function($request, $returnAttr, $allowProxy) { |
|
| 191 | 191 | $this->assertTrue($returnAttr); |
| 192 | 192 | $this->assertFalse($allowProxy); |
| 193 | 193 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | ) |
| 197 | 197 | ->once() |
| 198 | 198 | ->getMock(); |
| 199 | - $request = Mockery::mock(Request::class); |
|
| 199 | + $request = Mockery::mock(Request::class); |
|
| 200 | 200 | $this->assertEquals('casValidate called', $controller->v3ServiceValidateAction($request)); |
| 201 | 201 | } |
| 202 | 202 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | ->shouldAllowMockingProtectedMethods() |
| 208 | 208 | ->shouldReceive('casValidate') |
| 209 | 209 | ->andReturnUsing( |
| 210 | - function ($request, $returnAttr, $allowProxy) { |
|
| 210 | + function($request, $returnAttr, $allowProxy) { |
|
| 211 | 211 | $this->assertTrue($returnAttr); |
| 212 | 212 | $this->assertTrue($allowProxy); |
| 213 | 213 | |
@@ -216,13 +216,13 @@ discard block |
||
| 216 | 216 | ) |
| 217 | 217 | ->once() |
| 218 | 218 | ->getMock(); |
| 219 | - $request = Mockery::mock(Request::class); |
|
| 219 | + $request = Mockery::mock(Request::class); |
|
| 220 | 220 | $this->assertEquals('casValidate called', $controller->v3ProxyValidateAction($request)); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function testProxyActionWithInvalidRequest() |
| 224 | 224 | { |
| 225 | - $request = Mockery::mock(Request::class) |
|
| 225 | + $request = Mockery::mock(Request::class) |
|
| 226 | 226 | ->shouldReceive('get') |
| 227 | 227 | ->with('pgt', '') |
| 228 | 228 | ->andReturn('') |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | ->shouldAllowMockingProtectedMethods() |
| 242 | 242 | ->shouldReceive('proxyFailureResponse') |
| 243 | 243 | ->andReturnUsing( |
| 244 | - function ($code, $desc, $format) { |
|
| 244 | + function($code, $desc, $format) { |
|
| 245 | 245 | $this->assertEquals(CasException::INVALID_REQUEST, $code); |
| 246 | 246 | $this->assertEquals('param pgt and targetService can not be empty', $desc); |
| 247 | 247 | $this->assertEquals('XML', $format); |
@@ -258,15 +258,15 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | $request = Mockery::mock(Request::class) |
| 260 | 260 | ->shouldReceive('get') |
| 261 | - ->withArgs(['ticket', '']) |
|
| 261 | + ->withArgs([ 'ticket', '' ]) |
|
| 262 | 262 | ->andReturn('') |
| 263 | 263 | ->once() |
| 264 | 264 | ->shouldReceive('get') |
| 265 | - ->withArgs(['service', '']) |
|
| 265 | + ->withArgs([ 'service', '' ]) |
|
| 266 | 266 | ->andReturn('') |
| 267 | 267 | ->once() |
| 268 | 268 | ->shouldReceive('get') |
| 269 | - ->withArgs(['format', 'XML']) |
|
| 269 | + ->withArgs([ 'format', 'XML' ]) |
|
| 270 | 270 | ->andReturn('JSON') |
| 271 | 271 | ->once() |
| 272 | 272 | ->getMock(); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | ->shouldAllowMockingProtectedMethods() |
| 277 | 277 | ->shouldReceive('authFailureResponse') |
| 278 | 278 | ->andReturnUsing( |
| 279 | - function ($code, $desc, $format) { |
|
| 279 | + function($code, $desc, $format) { |
|
| 280 | 280 | $this->assertEquals(CasException::INVALID_REQUEST, $code); |
| 281 | 281 | $this->assertEquals('param service and ticket can not be empty', $desc); |
| 282 | 282 | $this->assertEquals('JSON', $format); |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | ) |
| 287 | 287 | ->once() |
| 288 | 288 | ->getMock(); |
| 289 | - $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 290 | - $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 289 | + $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 290 | + $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | public function testCasValidateAndLockTicketFailed() |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | ->once() |
| 302 | 302 | ->shouldReceive('authFailureResponse') |
| 303 | 303 | ->andReturnUsing( |
| 304 | - function ($code, $desc, $format) { |
|
| 304 | + function($code, $desc, $format) { |
|
| 305 | 305 | $this->assertEquals(CasException::INTERNAL_ERROR, $code); |
| 306 | 306 | $this->assertEquals('try to lock ticket failed', $desc); |
| 307 | 307 | $this->assertEquals('JSON', $format); |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | ) |
| 312 | 312 | ->once() |
| 313 | 313 | ->getMock(); |
| 314 | - $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 315 | - $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 314 | + $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 315 | + $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | public function testCasValidateWithInvalidTicket() |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | ->once() |
| 335 | 335 | ->shouldReceive('authFailureResponse') |
| 336 | 336 | ->andReturnUsing( |
| 337 | - function ($code, $desc, $format) { |
|
| 337 | + function($code, $desc, $format) { |
|
| 338 | 338 | $this->assertEquals(CasException::INVALID_TICKET, $code); |
| 339 | 339 | $this->assertEquals('ticket is not valid', $desc); |
| 340 | 340 | $this->assertEquals('JSON', $format); |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | ) |
| 345 | 345 | ->once() |
| 346 | 346 | ->getMock(); |
| 347 | - $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 348 | - $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 347 | + $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 348 | + $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | public function testCasValidateWithValidTicketButServiceMismatch() |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $request = $this->getValidRequest(); |
| 354 | 354 | $ticket = Mockery::mock(Ticket::class) |
| 355 | 355 | ->shouldReceive('getAttribute') |
| 356 | - ->withArgs(['service_url']) |
|
| 356 | + ->withArgs([ 'service_url' ]) |
|
| 357 | 357 | ->andReturn('http://github.com') |
| 358 | 358 | ->once() |
| 359 | 359 | ->shouldReceive('isProxy') |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | ->once() |
| 379 | 379 | ->shouldReceive('authFailureResponse') |
| 380 | 380 | ->andReturnUsing( |
| 381 | - function ($code, $desc, $format) { |
|
| 381 | + function($code, $desc, $format) { |
|
| 382 | 382 | $this->assertEquals(CasException::INVALID_SERVICE, $code); |
| 383 | 383 | $this->assertEquals('service is not valid', $desc); |
| 384 | 384 | $this->assertEquals('JSON', $format); |
@@ -388,8 +388,8 @@ discard block |
||
| 388 | 388 | ) |
| 389 | 389 | ->once() |
| 390 | 390 | ->getMock(); |
| 391 | - $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 392 | - $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 391 | + $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 392 | + $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | public function testCasValidateWithValidProxyTicketButNotAllowProxy() |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | ->once() |
| 419 | 419 | ->shouldReceive('authFailureResponse') |
| 420 | 420 | ->andReturnUsing( |
| 421 | - function ($code, $desc, $format) { |
|
| 421 | + function($code, $desc, $format) { |
|
| 422 | 422 | $this->assertEquals(CasException::INVALID_TICKET, $code); |
| 423 | 423 | $this->assertEquals('ticket is not valid', $desc); |
| 424 | 424 | $this->assertEquals('JSON', $format); |
@@ -428,20 +428,20 @@ discard block |
||
| 428 | 428 | ) |
| 429 | 429 | ->once() |
| 430 | 430 | ->getMock(); |
| 431 | - $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 432 | - $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 431 | + $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 432 | + $this->assertEquals('authFailureResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | public function testCasValidateWithValidProxyTicketAndAllowProxy() |
| 436 | 436 | { |
| 437 | - $proxies = ['http://proxy1.com', 'http://proxy2.com']; |
|
| 437 | + $proxies = [ 'http://proxy1.com', 'http://proxy2.com' ]; |
|
| 438 | 438 | $request = $this->getValidRequest(''); |
| 439 | 439 | $user = Mockery::mock(User::class) |
| 440 | 440 | ->shouldReceive('getName') |
| 441 | 441 | ->andReturn('test_user') |
| 442 | 442 | ->once() |
| 443 | 443 | ->getMock(); |
| 444 | - $ticket = Mockery::mock(Ticket::class) |
|
| 444 | + $ticket = Mockery::mock(Ticket::class) |
|
| 445 | 445 | ->shouldReceive('isProxy') |
| 446 | 446 | ->andReturn(true) |
| 447 | 447 | ->once() |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | ->andReturn($proxies) |
| 451 | 451 | ->once() |
| 452 | 452 | ->shouldReceive('getAttribute') |
| 453 | - ->withArgs(['service_url']) |
|
| 453 | + ->withArgs([ 'service_url' ]) |
|
| 454 | 454 | ->andReturn('http://leo108.com') |
| 455 | 455 | ->once() |
| 456 | 456 | ->shouldReceive('getAttribute') |
| 457 | - ->withArgs(['user']) |
|
| 457 | + ->withArgs([ 'user' ]) |
|
| 458 | 458 | ->andReturn($user) |
| 459 | 459 | ->times(2) |
| 460 | 460 | ->getMock(); |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | ->once() |
| 477 | 477 | ->shouldReceive('authSuccessResponse') |
| 478 | 478 | ->andReturnUsing( |
| 479 | - function ($name, $format, $attributes, $proxiesParam, $iou) use ($proxies) { |
|
| 479 | + function($name, $format, $attributes, $proxiesParam, $iou) use ($proxies) { |
|
| 480 | 480 | $this->assertEquals('test_user', $name); |
| 481 | 481 | $this->assertEmpty($attributes); |
| 482 | 482 | $this->assertEquals('JSON', $format); |
@@ -488,8 +488,8 @@ discard block |
||
| 488 | 488 | ) |
| 489 | 489 | ->once() |
| 490 | 490 | ->getMock(); |
| 491 | - $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 492 | - $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [$request, false, true])); |
|
| 491 | + $method = self::getNonPublicMethod($controller, 'casValidate'); |
|
| 492 | + $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [ $request, false, true ])); |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | public function testCasValidateWithValidTicketAndServiceAndNoPgt() |
@@ -500,16 +500,16 @@ discard block |
||
| 500 | 500 | ->andReturn('test_user') |
| 501 | 501 | ->once() |
| 502 | 502 | ->getMock(); |
| 503 | - $ticket = Mockery::mock(Ticket::class) |
|
| 503 | + $ticket = Mockery::mock(Ticket::class) |
|
| 504 | 504 | ->shouldReceive('isProxy') |
| 505 | 505 | ->andReturn(false) |
| 506 | 506 | ->times(2) |
| 507 | 507 | ->shouldReceive('getAttribute') |
| 508 | - ->withArgs(['service_url']) |
|
| 508 | + ->withArgs([ 'service_url' ]) |
|
| 509 | 509 | ->andReturn('http://leo108.com') |
| 510 | 510 | ->once() |
| 511 | 511 | ->shouldReceive('getAttribute') |
| 512 | - ->withArgs(['user']) |
|
| 512 | + ->withArgs([ 'user' ]) |
|
| 513 | 513 | ->andReturn($user) |
| 514 | 514 | ->times(2) |
| 515 | 515 | ->getMock(); |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | ->once() |
| 532 | 532 | ->shouldReceive('authSuccessResponse') |
| 533 | 533 | ->andReturnUsing( |
| 534 | - function ($name, $format, $attributes, $proxies, $iou) { |
|
| 534 | + function($name, $format, $attributes, $proxies, $iou) { |
|
| 535 | 535 | $this->assertEquals('test_user', $name); |
| 536 | 536 | $this->assertEmpty($attributes); |
| 537 | 537 | $this->assertEquals('JSON', $format); |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | ->getMock(); |
| 546 | 546 | |
| 547 | 547 | $method = self::getNonPublicMethod($controller, 'casValidate'); |
| 548 | - $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 548 | + $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | public function testCasValidateWithValidTicketAndServiceAndPgtButApplyPGTFailed() |
@@ -556,16 +556,16 @@ discard block |
||
| 556 | 556 | ->andReturn('test_user') |
| 557 | 557 | ->once() |
| 558 | 558 | ->getMock(); |
| 559 | - $ticket = Mockery::mock(Ticket::class) |
|
| 559 | + $ticket = Mockery::mock(Ticket::class) |
|
| 560 | 560 | ->shouldReceive('isProxy') |
| 561 | 561 | ->andReturn(false) |
| 562 | 562 | ->times(2) |
| 563 | 563 | ->shouldReceive('getAttribute') |
| 564 | - ->withArgs(['service_url']) |
|
| 564 | + ->withArgs([ 'service_url' ]) |
|
| 565 | 565 | ->andReturn('http://leo108.com') |
| 566 | 566 | ->once() |
| 567 | 567 | ->shouldReceive('getAttribute') |
| 568 | - ->withArgs(['user']) |
|
| 568 | + ->withArgs([ 'user' ]) |
|
| 569 | 569 | ->andReturn($user) |
| 570 | 570 | ->times(2) |
| 571 | 571 | ->getMock(); |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | ->once() |
| 594 | 594 | ->shouldReceive('authSuccessResponse') |
| 595 | 595 | ->andReturnUsing( |
| 596 | - function ($name, $format, $attributes, $proxies, $iou) { |
|
| 596 | + function($name, $format, $attributes, $proxies, $iou) { |
|
| 597 | 597 | $this->assertEquals('test_user', $name); |
| 598 | 598 | $this->assertEmpty($attributes); |
| 599 | 599 | $this->assertEquals('JSON', $format); |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | ->getMock(); |
| 608 | 608 | |
| 609 | 609 | $method = self::getNonPublicMethod($controller, 'casValidate'); |
| 610 | - $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 610 | + $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | public function testCasValidateWithValidTicketAndServiceAndPgtButCallPgtUrlFailed() |
@@ -618,16 +618,16 @@ discard block |
||
| 618 | 618 | ->andReturn('test_user') |
| 619 | 619 | ->once() |
| 620 | 620 | ->getMock(); |
| 621 | - $ticket = Mockery::mock(Ticket::class) |
|
| 621 | + $ticket = Mockery::mock(Ticket::class) |
|
| 622 | 622 | ->shouldReceive('isProxy') |
| 623 | 623 | ->andReturn(false) |
| 624 | 624 | ->times(2) |
| 625 | 625 | ->shouldReceive('getAttribute') |
| 626 | - ->withArgs(['service_url']) |
|
| 626 | + ->withArgs([ 'service_url' ]) |
|
| 627 | 627 | ->andReturn('http://leo108.com') |
| 628 | 628 | ->once() |
| 629 | 629 | ->shouldReceive('getAttribute') |
| 630 | - ->withArgs(['user']) |
|
| 630 | + ->withArgs([ 'user' ]) |
|
| 631 | 631 | ->andReturn($user) |
| 632 | 632 | ->times(2) |
| 633 | 633 | ->getMock(); |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | ->once() |
| 668 | 668 | ->shouldReceive('authSuccessResponse') |
| 669 | 669 | ->andReturnUsing( |
| 670 | - function ($name, $format, $attributes, $proxies, $iou) { |
|
| 670 | + function($name, $format, $attributes, $proxies, $iou) { |
|
| 671 | 671 | $this->assertEquals('test_user', $name); |
| 672 | 672 | $this->assertEmpty($attributes); |
| 673 | 673 | $this->assertEquals('JSON', $format); |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | ->getMock(); |
| 682 | 682 | |
| 683 | 683 | $method = self::getNonPublicMethod($controller, 'casValidate'); |
| 684 | - $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 684 | + $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | public function testCasValidateWithValidTicketAndServiceAndPgtButCallPgtUrlSuccess() |
@@ -692,16 +692,16 @@ discard block |
||
| 692 | 692 | ->andReturn('test_user') |
| 693 | 693 | ->once() |
| 694 | 694 | ->getMock(); |
| 695 | - $ticket = Mockery::mock(Ticket::class) |
|
| 695 | + $ticket = Mockery::mock(Ticket::class) |
|
| 696 | 696 | ->shouldReceive('isProxy') |
| 697 | 697 | ->andReturn(false) |
| 698 | 698 | ->times(2) |
| 699 | 699 | ->shouldReceive('getAttribute') |
| 700 | - ->withArgs(['service_url']) |
|
| 700 | + ->withArgs([ 'service_url' ]) |
|
| 701 | 701 | ->andReturn('http://leo108.com') |
| 702 | 702 | ->once() |
| 703 | 703 | ->shouldReceive('getAttribute') |
| 704 | - ->withArgs(['user']) |
|
| 704 | + ->withArgs([ 'user' ]) |
|
| 705 | 705 | ->andReturn($user) |
| 706 | 706 | ->times(2) |
| 707 | 707 | ->getMock(); |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | ->once() |
| 742 | 742 | ->shouldReceive('authSuccessResponse') |
| 743 | 743 | ->andReturnUsing( |
| 744 | - function ($name, $format, $attributes, $proxies, $iou) { |
|
| 744 | + function($name, $format, $attributes, $proxies, $iou) { |
|
| 745 | 745 | $this->assertEquals('test_user', $name); |
| 746 | 746 | $this->assertEmpty($attributes); |
| 747 | 747 | $this->assertEquals('JSON', $format); |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | ->getMock(); |
| 756 | 756 | |
| 757 | 757 | $method = self::getNonPublicMethod($controller, 'casValidate'); |
| 758 | - $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 758 | + $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | public function testCasValidateWithValidProxyTicketAndServiceAndPgtButCallPgtUrlSuccess() |
@@ -766,16 +766,16 @@ discard block |
||
| 766 | 766 | ->andReturn('test_user') |
| 767 | 767 | ->once() |
| 768 | 768 | ->getMock(); |
| 769 | - $ticket = Mockery::mock(Ticket::class) |
|
| 769 | + $ticket = Mockery::mock(Ticket::class) |
|
| 770 | 770 | ->shouldReceive('isProxy') |
| 771 | 771 | ->andReturn(false) |
| 772 | 772 | ->times(2) |
| 773 | 773 | ->shouldReceive('getAttribute') |
| 774 | - ->withArgs(['service_url']) |
|
| 774 | + ->withArgs([ 'service_url' ]) |
|
| 775 | 775 | ->andReturn('http://leo108.com') |
| 776 | 776 | ->once() |
| 777 | 777 | ->shouldReceive('getAttribute') |
| 778 | - ->withArgs(['user']) |
|
| 778 | + ->withArgs([ 'user' ]) |
|
| 779 | 779 | ->andReturn($user) |
| 780 | 780 | ->times(2) |
| 781 | 781 | ->getMock(); |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | ->once() |
| 816 | 816 | ->shouldReceive('authSuccessResponse') |
| 817 | 817 | ->andReturnUsing( |
| 818 | - function ($name, $format, $attributes, $proxies, $iou) { |
|
| 818 | + function($name, $format, $attributes, $proxies, $iou) { |
|
| 819 | 819 | $this->assertEquals('test_user', $name); |
| 820 | 820 | $this->assertEmpty($attributes); |
| 821 | 821 | $this->assertEquals('JSON', $format); |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | ->getMock(); |
| 830 | 830 | |
| 831 | 831 | $method = self::getNonPublicMethod($controller, 'casValidate'); |
| 832 | - $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [$request, false, false])); |
|
| 832 | + $this->assertEquals('authSuccessResponse called', $method->invokeArgs($controller, [ $request, false, false ])); |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | public function testLockTicket() |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | $controller = $this->initController() |
| 844 | 844 | ->makePartial(); |
| 845 | 845 | $method = self::getNonPublicMethod($controller, 'lockTicket'); |
| 846 | - $this->assertEquals('acquireLock called', $method->invokeArgs($controller, ['str', 30])); |
|
| 846 | + $this->assertEquals('acquireLock called', $method->invokeArgs($controller, [ 'str', 30 ])); |
|
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | public function testUnlockTicket() |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | $controller = $this->initController() |
| 858 | 858 | ->makePartial(); |
| 859 | 859 | $method = self::getNonPublicMethod($controller, 'unlockTicket'); |
| 860 | - $this->assertEquals('releaseLock called', $method->invokeArgs($controller, ['str', 30])); |
|
| 860 | + $this->assertEquals('releaseLock called', $method->invokeArgs($controller, [ 'str', 30 ])); |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | public function testAuthSuccessResponse() |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | $attributes = [ |
| 871 | 871 | 'real_name' => 'real_name', |
| 872 | 872 | ]; |
| 873 | - $proxies = ['http://proxy1.com']; |
|
| 873 | + $proxies = [ 'http://proxy1.com' ]; |
|
| 874 | 874 | $pgt = 'ticket'; |
| 875 | 875 | $jsonResp = Mockery::mock(JsonAuthenticationSuccessResponse::class) |
| 876 | 876 | ->shouldReceive('setUser') |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | ->once() |
| 887 | 887 | ->getMock(); |
| 888 | 888 | app()->instance(JsonAuthenticationSuccessResponse::class, $jsonResp); |
| 889 | - $method->invokeArgs($controller, ['test_name', 'JSON', $attributes, $proxies, []]); |
|
| 889 | + $method->invokeArgs($controller, [ 'test_name', 'JSON', $attributes, $proxies, [ ] ]); |
|
| 890 | 890 | |
| 891 | 891 | $xmlResp = Mockery::mock(XmlAuthenticationSuccessResponse::class) |
| 892 | 892 | ->shouldReceive('setUser') |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | ->once() |
| 906 | 906 | ->getMock(); |
| 907 | 907 | app()->instance(XmlAuthenticationSuccessResponse::class, $xmlResp); |
| 908 | - $method->invokeArgs($controller, ['test_name', 'XML', $attributes, $proxies, $pgt]); |
|
| 908 | + $method->invokeArgs($controller, [ 'test_name', 'XML', $attributes, $proxies, $pgt ]); |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | public function testAuthFailureResponse() |
@@ -917,40 +917,40 @@ discard block |
||
| 917 | 917 | $desc = 'desc'; |
| 918 | 918 | $jsonResp = Mockery::mock(JsonAuthenticationFailureResponse::class) |
| 919 | 919 | ->shouldReceive('setFailure') |
| 920 | - ->withArgs([$code, $desc]) |
|
| 920 | + ->withArgs([ $code, $desc ]) |
|
| 921 | 921 | ->once() |
| 922 | 922 | ->shouldReceive('toResponse') |
| 923 | 923 | ->once() |
| 924 | 924 | ->getMock(); |
| 925 | 925 | app()->instance(JsonAuthenticationFailureResponse::class, $jsonResp); |
| 926 | - $method->invokeArgs($controller, [$code, $desc, 'JSON']); |
|
| 926 | + $method->invokeArgs($controller, [ $code, $desc, 'JSON' ]); |
|
| 927 | 927 | |
| 928 | 928 | $xmlResp = Mockery::mock(XmlAuthenticationFailureResponse::class) |
| 929 | 929 | ->shouldReceive('setFailure') |
| 930 | - ->withArgs([$code, $desc]) |
|
| 930 | + ->withArgs([ $code, $desc ]) |
|
| 931 | 931 | ->once() |
| 932 | 932 | ->shouldReceive('toResponse') |
| 933 | 933 | ->once() |
| 934 | 934 | ->getMock(); |
| 935 | 935 | app()->instance(XmlAuthenticationFailureResponse::class, $xmlResp); |
| 936 | - $method->invokeArgs($controller, [$code, $desc, 'XML']); |
|
| 936 | + $method->invokeArgs($controller, [ $code, $desc, 'XML' ]); |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | protected function getValidRequest($pgt = null) |
| 940 | 940 | { |
| 941 | 941 | $mock = Mockery::mock(Request::class) |
| 942 | 942 | ->shouldReceive('get') |
| 943 | - ->withArgs(['ticket', '']) |
|
| 943 | + ->withArgs([ 'ticket', '' ]) |
|
| 944 | 944 | ->andReturn('ticket') |
| 945 | 945 | ->shouldReceive('get') |
| 946 | - ->withArgs(['service', '']) |
|
| 946 | + ->withArgs([ 'service', '' ]) |
|
| 947 | 947 | ->andReturn('http://leo108.com') |
| 948 | 948 | ->shouldReceive('get') |
| 949 | - ->withArgs(['format', 'XML']) |
|
| 949 | + ->withArgs([ 'format', 'XML' ]) |
|
| 950 | 950 | ->andReturn('JSON'); |
| 951 | 951 | if (!is_null($pgt)) { |
| 952 | 952 | $mock->shouldReceive('get') |
| 953 | - ->withArgs(['pgtUrl', '']) |
|
| 953 | + ->withArgs([ 'pgtUrl', '' ]) |
|
| 954 | 954 | ->andReturn($pgt); |
| 955 | 955 | } |
| 956 | 956 | |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | use Leo108\CAS\Models\Ticket; |
| 14 | 14 | use Leo108\CAS\Services\TicketGenerator; |
| 15 | 15 | use Mockery; |
| 16 | -use ReflectionClass; |
|
| 17 | 16 | use TestCase; |
| 18 | 17 | use User; |
| 19 | 18 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | //test if service url is not valid |
| 25 | 25 | $user = Mockery::mock(User::class) |
| 26 | 26 | ->shouldReceive('getAttribute') |
| 27 | - ->withArgs(['id']) |
|
| 27 | + ->withArgs([ 'id' ]) |
|
| 28 | 28 | ->andReturn(1) |
| 29 | 29 | ->shouldReceive('getEloquentModel') |
| 30 | 30 | ->andReturn(Mockery::self()) |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | //test if get available ticket failed |
| 46 | - $service = Mockery::mock(Service::class) |
|
| 46 | + $service = Mockery::mock(Service::class) |
|
| 47 | 47 | ->shouldReceive('getAttribute') |
| 48 | - ->withArgs(['id']) |
|
| 48 | + ->withArgs([ 'id' ]) |
|
| 49 | 49 | ->andReturn(1) |
| 50 | 50 | ->getMock(); |
| 51 | 51 | $serviceRepository = Mockery::mock(ServiceRepository::class) |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $serviceUrl = 'what ever'; |
| 74 | 74 | $service = Mockery::mock(Service::class) |
| 75 | 75 | ->shouldReceive('getAttribute') |
| 76 | - ->withArgs(['id']) |
|
| 76 | + ->withArgs([ 'id' ]) |
|
| 77 | 77 | ->andReturn(1) |
| 78 | 78 | ->getMock(); |
| 79 | 79 | $serviceRepository = Mockery::mock(ServiceRepository::class) |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | $ticket = Mockery::mock(Ticket::class) |
| 85 | 85 | ->shouldReceive('newInstance') |
| 86 | 86 | ->andReturnUsing( |
| 87 | - function ($param) { |
|
| 87 | + function($param) { |
|
| 88 | 88 | $obj = Mockery::mock(); |
| 89 | 89 | $obj->shouldReceive('user->associate'); |
| 90 | 90 | $obj->shouldReceive('service->associate'); |
| 91 | 91 | $obj->shouldReceive('save'); |
| 92 | - $obj->ticket = $param['ticket']; |
|
| 93 | - $obj->service_url = $param['service_url']; |
|
| 92 | + $obj->ticket = $param[ 'ticket' ]; |
|
| 93 | + $obj->service_url = $param[ 'service_url' ]; |
|
| 94 | 94 | |
| 95 | 95 | return $obj; |
| 96 | 96 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $mockTicket = Mockery::mock(Ticket::class) |
| 120 | 120 | ->shouldReceive('isExpired') |
| 121 | - ->andReturnValues([false, true]) |
|
| 121 | + ->andReturnValues([ false, true ]) |
|
| 122 | 122 | ->getMock(); |
| 123 | 123 | |
| 124 | 124 | $ticket = Mockery::mock(Ticket::class); |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | $ticketGenerator = Mockery::mock(TicketGenerator::class) |
| 147 | 147 | ->shouldReceive('generate') |
| 148 | 148 | ->andReturnUsing( |
| 149 | - function ($totalLength, $paramPrefix, callable $checkFunc, $maxRetry) use ($length, $prefix, $ticket) { |
|
| 149 | + function($totalLength, $paramPrefix, callable $checkFunc, $maxRetry) use ($length, $prefix, $ticket) { |
|
| 150 | 150 | $this->assertEquals($length, $totalLength); |
| 151 | 151 | $this->assertEquals($prefix, $paramPrefix); |
| 152 | - $this->assertEquals('getByTicket called', call_user_func_array($checkFunc, [$ticket])); |
|
| 152 | + $this->assertEquals('getByTicket called', call_user_func_array($checkFunc, [ $ticket ])); |
|
| 153 | 153 | $this->assertEquals(10, $maxRetry); |
| 154 | 154 | |
| 155 | 155 | return 'generate called'; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | { |
| 184 | 184 | return Mockery::mock( |
| 185 | 185 | TicketRepository::class, |
| 186 | - [app(Ticket::class), app(ServiceRepository::class), app(TicketGenerator::class)] |
|
| 186 | + [ app(Ticket::class), app(ServiceRepository::class), app(TicketGenerator::class) ] |
|
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -6,12 +6,12 @@ |
||
| 6 | 6 | ]; |
| 7 | 7 | |
| 8 | 8 | if (config('cas.middleware.common')) { |
| 9 | - $options['middleware'] = config('cas.middleware.common'); |
|
| 9 | + $options[ 'middleware' ] = config('cas.middleware.common'); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | Route::group( |
| 13 | 13 | $options, |
| 14 | - function () { |
|
| 14 | + function() { |
|
| 15 | 15 | $auth = config('cas.middleware.auth'); |
| 16 | 16 | $p = config('cas.router.name_prefix'); |
| 17 | 17 | Route::get('login', 'SecurityController@showLogin')->name($p.'login.get'); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return $this->authFailureResponse($e->getCasErrorCode(), $e->getMessage(), $format); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $proxies = []; |
|
| 192 | + $proxies = [ ]; |
|
| 193 | 193 | if ($record->isProxy()) { |
| 194 | 194 | $proxies = $record->proxies; |
| 195 | 195 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - $attr = $returnAttr ? $record->user->getCASAttributes() : []; |
|
| 216 | + $attr = $returnAttr ? $record->user->getCASAttributes() : [ ]; |
|
| 217 | 217 | |
| 218 | 218 | return $this->authSuccessResponse($record->user->getName(), $format, $attr, $proxies, $iou); |
| 219 | 219 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @param string|null $pgt |
| 227 | 227 | * @return Response |
| 228 | 228 | */ |
| 229 | - protected function authSuccessResponse($username, $format, $attributes, $proxies = [], $pgt = null) |
|
| 229 | + protected function authSuccessResponse($username, $format, $attributes, $proxies = [ ], $pgt = null) |
|
| 230 | 230 | { |
| 231 | 231 | if (strtoupper($format) === 'JSON') { |
| 232 | 232 | $resp = app(JsonAuthenticationSuccessResponse::class); |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | protected $table = 'cas_proxy_granting_tickets'; |
| 32 | 32 | public $timestamps = false; |
| 33 | - protected $fillable = ['ticket', 'pgt_url', 'proxies', 'expire_at', 'created_at']; |
|
| 33 | + protected $fillable = [ 'ticket', 'pgt_url', 'proxies', 'expire_at', 'created_at' ]; |
|
| 34 | 34 | |
| 35 | 35 | public function getProxiesAttribute() |
| 36 | 36 | { |
| 37 | - $ret = json_decode($this->attributes['proxies'], true); |
|
| 37 | + $ret = json_decode($this->attributes[ 'proxies' ], true); |
|
| 38 | 38 | if (!$ret) { |
| 39 | - return []; |
|
| 39 | + return [ ]; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | return $ret; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function setProxiesAttribute($value) |
| 46 | 46 | { |
| 47 | - $this->attributes['proxies'] = json_encode($value); |
|
| 47 | + $this->attributes[ 'proxies' ] = json_encode($value); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function isExpired() |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | protected $table = 'cas_tickets'; |
| 32 | 32 | public $timestamps = false; |
| 33 | - protected $fillable = ['ticket', 'service_url', 'proxies', 'expire_at', 'created_at']; |
|
| 33 | + protected $fillable = [ 'ticket', 'service_url', 'proxies', 'expire_at', 'created_at' ]; |
|
| 34 | 34 | |
| 35 | 35 | public function getProxiesAttribute() |
| 36 | 36 | { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | return null; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - return json_decode($this->attributes['proxies'], true); |
|
| 41 | + return json_decode($this->attributes[ 'proxies' ], true); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function setProxiesAttribute($value) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | if ($this->id && !$this->isProxy()) { |
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | - $this->attributes['proxies'] = json_encode($value); |
|
| 49 | + $this->attributes[ 'proxies' ] = json_encode($value); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function isExpired() |
@@ -66,6 +66,6 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function isProxy() |
| 68 | 68 | { |
| 69 | - return !is_null($this->attributes['proxies']); |
|
| 69 | + return !is_null($this->attributes[ 'proxies' ]); |
|
| 70 | 70 | } |
| 71 | 71 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return PGTicket |
| 69 | 69 | * @throws CasException |
| 70 | 70 | */ |
| 71 | - public function applyTicket(UserModel $user, $pgtUrl, $proxies = []) |
|
| 71 | + public function applyTicket(UserModel $user, $pgtUrl, $proxies = [ ]) |
|
| 72 | 72 | { |
| 73 | 73 | $service = $this->serviceRepository->getServiceByUrl($pgtUrl); |
| 74 | 74 | if (!$service || !$service->allow_proxy) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | return $this->ticketGenerator->generate( |
| 105 | 105 | $totalLength, |
| 106 | 106 | 'PGT-', |
| 107 | - function ($ticket) { |
|
| 107 | + function($ticket) { |
|
| 108 | 108 | return $this->getByTicket($ticket, false); |
| 109 | 109 | }, |
| 110 | 110 | 10 |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | $flag = false; |
| 27 | 27 | for ($i = 0; $i < $maxRetry; $i++) { |
| 28 | 28 | $ticket = $this->generateOne($totalLength, $prefix); |
| 29 | - if (!call_user_func_array($checkFunc, [$ticket])) { |
|
| 29 | + if (!call_user_func_array($checkFunc, [ $ticket ])) { |
|
| 30 | 30 | $flag = true; |
| 31 | 31 | break; |
| 32 | 32 | } |