@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | 4 | 'impersonate' => [ |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Scif\LaravelPretend\Event; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Scif\LaravelPretend\Interfaces; |
| 4 | 4 | |
@@ -36,10 +36,10 @@ |
||
| 36 | 36 | public function register() |
| 37 | 37 | { |
| 38 | 38 | $this->app->when(Impersonator::class) |
| 39 | - ->needs(UserProvider::class) |
|
| 40 | - ->give(function (): UserProvider { |
|
| 41 | - return \Auth::getProvider(); |
|
| 42 | - }); |
|
| 39 | + ->needs(UserProvider::class) |
|
| 40 | + ->give(function (): UserProvider { |
|
| 41 | + return \Auth::getProvider(); |
|
| 42 | + }); |
|
| 43 | 43 | |
| 44 | 44 | $this->app->singleton(Impersonator::class, Impersonator::class); |
| 45 | 45 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Scif\LaravelPretend; |
| 4 | 4 | |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $configPath = __DIR__ . '/../config/pretend.php'; |
| 19 | 19 | |
| 20 | - if ( ! $this->isLumen()) { |
|
| 21 | - $this->publishes([$configPath => config_path('pretend.php')], 'config'); |
|
| 20 | + if (!$this->isLumen()) { |
|
| 21 | + $this->publishes([ $configPath => config_path('pretend.php') ], 'config'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $this->mergeConfigFrom($configPath, 'pretend'); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | $this->app->when(Impersonator::class) |
| 39 | 39 | ->needs(UserProvider::class) |
| 40 | - ->give(function (): UserProvider { |
|
| 40 | + ->give(function(): UserProvider { |
|
| 41 | 41 | return \Auth::getProvider(); |
| 42 | 42 | }); |
| 43 | 43 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Scif\LaravelPretend\Event; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Scif\LaravelPretend\Middleware; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Scif\LaravelPretend\Service; |
| 4 | 4 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function enterImpersonation(string $username) |
| 103 | 103 | { |
| 104 | - $user = $this->retrieveUser($username); |
|
| 104 | + $user = $this->retrieveUser($username); |
|
| 105 | 105 | |
| 106 | 106 | if ($user->getAuthIdentifier() === $this->realUser->getAuthIdentifier()) { |
| 107 | 107 | abort(403, 'Cannot impersonate yourself'); |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Scif\LaravelPretend\Middleware; |
| 4 | 4 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | if (!$request->isXmlHttpRequest() && $request->isMethod('GET')) { |
| 81 | 81 | $input = $request->input(); |
| 82 | - unset($input['_switch_user']); |
|
| 82 | + unset($input[ '_switch_user' ]); |
|
| 83 | 83 | $input += $request->route()->parameters(); |
| 84 | 84 | |
| 85 | 85 | return $this->redirect->route( |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function checkPermission(string $username) |
| 104 | 104 | { |
| 105 | - $ability = $this->config->get('pretend.impersonate.auth_check'); |
|
| 105 | + $ability = $this->config->get('pretend.impersonate.auth_check'); |
|
| 106 | 106 | |
| 107 | 107 | if (!$this->gate->has($ability)) { |
| 108 | 108 | |
| 109 | - $this->gate->define($ability, function ($user): bool { |
|
| 109 | + $this->gate->define($ability, function($user): bool { |
|
| 110 | 110 | if (!$user instanceof Impersonable) { |
| 111 | 111 | return false; |
| 112 | 112 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | }); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if (!$this->gate->forUser($this->guard->user())->check($ability, [$username])) { |
|
| 118 | + if (!$this->gate->forUser($this->guard->user())->check($ability, [ $username ])) { |
|
| 119 | 119 | abort(403, "Current user have no ability '{$ability}'"); |
| 120 | 120 | } |
| 121 | 121 | } |