@@ -12,7 +12,7 @@ |
||
| 12 | 12 | trait AuthorizationTrait |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * @return \App\Containers\User\Models\User|null |
|
| 15 | + * @return \Illuminate\Contracts\Auth\Authenticatable|null |
|
| 16 | 16 | */ |
| 17 | 17 | public function getUser() |
| 18 | 18 | { |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace App\Ship\Parents\Requests; |
| 4 | 4 | |
| 5 | -use App\Containers\Authorization\Traits\AuthorizationTrait; |
|
| 6 | 5 | use App\Ship\Engine\Traits\HashIdTrait; |
| 7 | 6 | use Illuminate\Foundation\Http\FormRequest as LaravelFormRequest; |
| 8 | 7 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | public function hasAccess(User $user = null) |
| 29 | 29 | { |
| 30 | 30 | // if not in parameters, take from the request object {$this} |
| 31 | - $user = $user ? : $this->user(); |
|
| 31 | + $user = $user ?: $this->user(); |
|
| 32 | 32 | |
| 33 | 33 | $hasAccess = array_merge( |
| 34 | 34 | $this->hasAnyPermissionAccess($user), |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | * To call functions and compare their bool responses to determine |
| 53 | 53 | * if the user can proceed with the request or not. |
| 54 | 54 | * |
| 55 | - * @param array $functions |
|
| 55 | + * @param string[] $functions |
|
| 56 | 56 | * |
| 57 | 57 | * @return bool |
| 58 | 58 | */ |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $permissions = explode('|', $this->access['permissions']); |
| 127 | 127 | |
| 128 | - $hasAccess = array_map(function ($permission) use ($user) { |
|
| 128 | + $hasAccess = array_map(function($permission) use ($user) { |
|
| 129 | 129 | // Note: internal return |
| 130 | 130 | return $user->hasPermissionTo($permission); |
| 131 | 131 | }, $permissions); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $roles = explode('|', $this->access['roles']); |
| 148 | 148 | |
| 149 | - $hasAccess = array_map(function ($role) use ($user) { |
|
| 149 | + $hasAccess = array_map(function($role) use ($user) { |
|
| 150 | 150 | // Note: internal return |
| 151 | 151 | return $user->hasRole($role); |
| 152 | 152 | }, $roles); |
@@ -42,6 +42,6 @@ |
||
| 42 | 42 | $router->post('admins', [ |
| 43 | 43 | 'uses' => 'Controller@createAdmin', |
| 44 | 44 | 'middleware' => [ |
| 45 | - 'api.auth', |
|
| 45 | + 'api.auth', |
|
| 46 | 46 | ], |
| 47 | 47 | ]); |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace App\Ship\Parents\Tests\PhpUnit; |
| 4 | 4 | |
| 5 | 5 | use App\Ship\Engine\Traits\HashIdTrait; |
| 6 | -use App\Ship\Features\Tests\PhpUnit\TestingTrait; |
|
| 7 | 6 | use App\Ship\Features\Tests\PhpUnit\TestsAuthHelperTrait; |
| 8 | 7 | use App\Ship\Features\Tests\PhpUnit\TestsCustomHelperTrait; |
| 9 | 8 | use App\Ship\Features\Tests\PhpUnit\TestsMockHelperTrait; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | /** |
| 183 | 183 | * @param $subject |
| 184 | 184 | * @param $findKey |
| 185 | - * @param $callback |
|
| 185 | + * @param \Closure $callback |
|
| 186 | 186 | * |
| 187 | 187 | * @return array |
| 188 | 188 | */ |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | - * @param $search |
|
| 209 | + * @param string $search |
|
| 210 | 210 | * @param $subject |
| 211 | 211 | * |
| 212 | 212 | * @return mixed |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | - * @param $needle |
|
| 228 | + * @param string $needle |
|
| 229 | 229 | * @param $haystack |
| 230 | 230 | * |
| 231 | 231 | * @return int |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function runHashedIdsDecoder() |
| 30 | 30 | { |
| 31 | 31 | if (Config::get('hello.hash-id')) { |
| 32 | - Route::bind('id', function ($id, $route) { |
|
| 32 | + Route::bind('id', function($id, $route) { |
|
| 33 | 33 | // skip decoding some endpoints |
| 34 | 34 | if (!in_array($route->uri(), $this->skippedEndpoints)) { |
| 35 | 35 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | // hash the ID only if hash-id enabled in the config |
| 60 | 60 | if (Config::get('hello.hash-id')) { |
| 61 | - return $this->encoder(($key) ? : $this->getKey()); |
|
| 61 | + return $this->encoder(($key) ?: $this->getKey()); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return $this->getKey(); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | // get the last part of the key, which should be the ID that needs decoding |
| 140 | 140 | $idToDecode = substr($key, strrpos($key, '.*.') + 3); |
| 141 | 141 | |
| 142 | - array_walk_recursive($requestData, function (&$value, $key) use ($idToDecode) { |
|
| 142 | + array_walk_recursive($requestData, function(&$value, $key) use ($idToDecode) { |
|
| 143 | 143 | |
| 144 | 144 | if ($key == $idToDecode) { |
| 145 | 145 | $value = $this->decode($value, $key); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | $idToDecode = $this->removeLastOccurrenceFromString($key, '.*'); |
| 158 | 158 | |
| 159 | - $this->findKeyAndReturnValue($requestData, $idToDecode, function ($ids) use ($key){ |
|
| 159 | + $this->findKeyAndReturnValue($requestData, $idToDecode, function($ids) use ($key){ |
|
| 160 | 160 | |
| 161 | 161 | if (!is_array($ids)) { |
| 162 | 162 | throw new IncorrectIdException('Expected ID\'s to be in array. Please wrap your ID\'s in an Array and send them back.'); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | public function extendValidationRules() |
| 19 | 19 | { |
| 20 | 20 | // Validate String contains no space. |
| 21 | - Validator::extend('no_spaces', function ($attribute, $value, $parameters, $validator) { |
|
| 21 | + Validator::extend('no_spaces', function($attribute, $value, $parameters, $validator) { |
|
| 22 | 22 | return preg_match('/^\S*$/u', $value); |
| 23 | 23 | }, ['String should not contain space.']); |
| 24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | // Usage: unique_composite:table,this-attribute-column,the-other-attribute-column |
| 27 | 27 | // Example: 'values' => 'required|unique_composite:item_variant_values,value,item_variant_name_id', |
| 28 | 28 | // 'item_variant_name_id' => 'required', |
| 29 | - Validator::extend('unique_composite', function ($attribute, $value, $parameters, $validator) { |
|
| 29 | + Validator::extend('unique_composite', function($attribute, $value, $parameters, $validator) { |
|
| 30 | 30 | |
| 31 | 31 | $queryBuilder = \DB::table($parameters[0]); |
| 32 | 32 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | private function findLanguage($request) |
| 64 | 64 | { |
| 65 | 65 | // read the language from the request header, if the header is missed, take the default local language |
| 66 | - return $request->header('Content-Language') ? : Config::get('app.locale'); |
|
| 66 | + return $request->header('Content-Language') ?: Config::get('app.locale'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * @param $lang |
|
| 44 | + * @param string $lang |
|
| 45 | 45 | * |
| 46 | 46 | * @return string|Exception |
| 47 | 47 | */ |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * @param $request |
|
| 60 | + * @param Request $request |
|
| 61 | 61 | * |
| 62 | 62 | * @return string |
| 63 | 63 | */ |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | /** |
| 27 | 27 | * Registering Route Group's |
| 28 | 28 | * |
| 29 | - * @param array $middlewareGroups |
|
| 29 | + * @param array $middlewares |
|
| 30 | 30 | */ |
| 31 | 31 | private function registerMiddleware(array $middlewares = []) |
| 32 | 32 | { |