@@ -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 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Scif\LaravelPretend\Middleware; |
| 4 | 4 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function handle(Request $request, Closure $next) |
| 34 | 34 | { |
| 35 | - $this->eventDispatcher->listen(Impersonated::class, function () { |
|
| 35 | + $this->eventDispatcher->listen(Impersonated::class, function() { |
|
| 36 | 36 | abort(403, 'This route is forbidden to access as impersonated user'); |
| 37 | 37 | }); |
| 38 | 38 | |
@@ -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 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if (!$request->isXmlHttpRequest() && $request->isMethod('GET')) { |
| 76 | 76 | $input = $request->input(); |
| 77 | - unset($input['_switch_user']); |
|
| 77 | + unset($input[ '_switch_user' ]); |
|
| 78 | 78 | $input += $request->route()->parameters(); |
| 79 | 79 | |
| 80 | 80 | return $this->redirect->route( |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | protected function checkPermission(string $username) |
| 99 | 99 | { |
| 100 | - $ability = $this->config->get('pretend.impersonate.auth_check'); |
|
| 100 | + $ability = $this->config->get('pretend.impersonate.auth_check'); |
|
| 101 | 101 | |
| 102 | 102 | if (!$this->gate->has($ability)) { |
| 103 | 103 | |
| 104 | - $this->gate->define($ability, function ($user): bool { |
|
| 104 | + $this->gate->define($ability, function($user): bool { |
|
| 105 | 105 | if (!$user instanceof Impersonable) { |
| 106 | 106 | return false; |
| 107 | 107 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | }); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if (!$this->gate->forUser($this->guard->user())->check($ability, [ $username] )) { |
|
| 113 | + if (!$this->gate->forUser($this->guard->user())->check($ability, [ $username ])) { |
|
| 114 | 114 | abort(403, "Current user have no ability '{$ability}'"); |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -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\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\Service; |
| 4 | 4 | |