@@ -18,10 +18,10 @@ |
||
| 18 | 18 | public function boot() |
| 19 | 19 | { |
| 20 | 20 | $handler = app('Dingo\Api\Exception\Handler'); |
| 21 | - $handler->register(function (AuthenticationException $exception) { |
|
| 21 | + $handler->register(function(AuthenticationException $exception) { |
|
| 22 | 22 | throw new UnauthorizedHttpException(null, $exception->getMessage()); |
| 23 | 23 | }); |
| 24 | - $handler->register(function (AuthorizationException $exception) { |
|
| 24 | + $handler->register(function(AuthorizationException $exception) { |
|
| 25 | 25 | throw new AccessDeniedHttpException($exception->getMessage()); |
| 26 | 26 | }); |
| 27 | 27 | } |
@@ -52,8 +52,8 @@ |
||
| 52 | 52 | protected function mapWebRoutes() |
| 53 | 53 | { |
| 54 | 54 | Route::middleware('web') |
| 55 | - ->namespace($this->namespace) |
|
| 56 | - ->group(base_path('routes/web.php')); |
|
| 55 | + ->namespace($this->namespace) |
|
| 56 | + ->group(base_path('routes/web.php')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | { |
| 72 | 72 | if ($this->presenter instanceof PresenterInterface) { |
| 73 | 73 | if ($result instanceof Collection || $result instanceof LengthAwarePaginator) { |
| 74 | - $result->each(function ($model) { |
|
| 74 | + $result->each(function($model) { |
|
| 75 | 75 | if ($model instanceof Presentable) { |
| 76 | 76 | $model->setPresenter($this->presenter); |
| 77 | 77 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $search = $this->parserSearchValue($search); |
| 38 | 38 | $modelForceAndWhere = method_exists($repository, 'getIsSearchableForceAndWhere') ? $repository->getIsSearchableForceAndWhere() : false; |
| 39 | 39 | |
| 40 | - $model = $model->where(function ($query) use ($fields, $search, $searchData, $isFirstField, $modelForceAndWhere) { |
|
| 40 | + $model = $model->where(function($query) use ($fields, $search, $searchData, $isFirstField, $modelForceAndWhere) { |
|
| 41 | 41 | /* @var Builder $query */ |
| 42 | 42 | |
| 43 | 43 | foreach ($fields as $field => $condition) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if ($isFirstField || $modelForceAndWhere) { |
| 93 | 93 | if (!is_null($value)) { |
| 94 | 94 | if (!is_null($relation)) { |
| 95 | - $query->whereHas($relation, function ($query) use ($field, $condition, $value) { |
|
| 95 | + $query->whereHas($relation, function($query) use ($field, $condition, $value) { |
|
| 96 | 96 | $query->where($field, $condition, $value); |
| 97 | 97 | }); |
| 98 | 98 | } else { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } else { |
| 104 | 104 | if (!is_null($value)) { |
| 105 | 105 | if (!is_null($relation)) { |
| 106 | - $query->orWhereHas($relation, function ($query) use ($field, $condition, $value) { |
|
| 106 | + $query->orWhereHas($relation, function($query) use ($field, $condition, $value) { |
|
| 107 | 107 | $query->where($field, $condition, $value); |
| 108 | 108 | }); |
| 109 | 109 | } else { |
@@ -203,15 +203,15 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $routes = app('router')->getRoutes(); |
| 205 | 205 | $prefix = config('yeelight.backend.tools.api-tester.prefix'); |
| 206 | - $routes = collect($routes)->filter(function ($route) use ($prefix) { |
|
| 206 | + $routes = collect($routes)->filter(function($route) use ($prefix) { |
|
| 207 | 207 | return Str::startsWith($route->uri, config('yeelight.backend.tools.api-tester.prefix')); |
| 208 | - })->map(function ($route) { |
|
| 208 | + })->map(function($route) { |
|
| 209 | 209 | return $this->getRouteInformation($route); |
| 210 | 210 | })->all(); |
| 211 | 211 | if ($sort = request('_sort')) { |
| 212 | 212 | $routes = $this->sortRoutes($sort, $routes); |
| 213 | 213 | } |
| 214 | - $routes = collect($routes)->filter()->map(function ($route) { |
|
| 214 | + $routes = collect($routes)->filter()->map(function($route) { |
|
| 215 | 215 | $route['parameters'] = json_encode($this->getRouteParameters($route['action'])); |
| 216 | 216 | unset($route['middleware'], $route['host'], $route['name'], $route['action']); |
| 217 | 217 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | foreach (array_get($matches, 1, []) as $item) { |
| 247 | 247 | preg_match_all('/(\w+)=[\'"]?([^\r\n"]+)[\'"]?,?\n/s', $item, $match); |
| 248 | 248 | if (count($match) == 3) { |
| 249 | - $match[2] = array_map(function ($val) { |
|
| 249 | + $match[2] = array_map(function($val) { |
|
| 250 | 250 | return trim($val, ','); |
| 251 | 251 | }, $match[2]); |
| 252 | 252 | $parameters[] = array_combine($match[1], $match[2]); |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | protected function sortRoutes($sort, $routes) |
| 304 | 304 | { |
| 305 | - return Arr::sort($routes, function ($route) use ($sort) { |
|
| 305 | + return Arr::sort($routes, function($route) use ($sort) { |
|
| 306 | 306 | return $route[$sort]; |
| 307 | 307 | }); |
| 308 | 308 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | protected function getRouteMiddleware($route) |
| 318 | 318 | { |
| 319 | - return collect($route->gatherMiddleware())->map(function ($middleware) { |
|
| 319 | + return collect($route->gatherMiddleware())->map(function($middleware) { |
|
| 320 | 320 | return $middleware instanceof \Closure ? 'Closure' : $middleware; |
| 321 | 321 | }); |
| 322 | 322 | } |
@@ -64,8 +64,8 @@ |
||
| 64 | 64 | * Minimum and maximum years to cope with the Year 2038 problem in UNIX. We run PHP which most likely runs on a UNIX environment so we |
| 65 | 65 | * must assume vulnerability. |
| 66 | 66 | */ |
| 67 | - protected $RANGE_YEARS_MIN = 1970; // Must match date range supported by date(). See also: http://en.wikipedia.org/wiki/Year_2038_problem |
|
| 68 | - protected $RANGE_YEARS_MAX = 2037; // Must match date range supported by date(). See also: http://en.wikipedia.org/wiki/Year_2038_problem |
|
| 67 | + protected $RANGE_YEARS_MIN = 1970; // Must match date range supported by date(). See also: http://en.wikipedia.org/wiki/Year_2038_problem |
|
| 68 | + protected $RANGE_YEARS_MAX = 2037; // Must match date range supported by date(). See also: http://en.wikipedia.org/wiki/Year_2038_problem |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Function: __construct. |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $method = $this->http_method; |
| 100 | 100 | |
| 101 | - $matches = array_map(function ($path) use ($method) { |
|
| 101 | + $matches = array_map(function($path) use ($method) { |
|
| 102 | 102 | $path = trim(config('yeelight.backend.route.prefix'), '/').$path; |
| 103 | 103 | |
| 104 | 104 | if (Str::contains($path, ':')) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $method = collect($match['method'])->filter()->map(function ($method) { |
|
| 135 | + $method = collect($match['method'])->filter()->map(function($method) { |
|
| 136 | 136 | return strtoupper($method); |
| 137 | 137 | }); |
| 138 | 138 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | if (is_array($permission)) { |
| 31 | - collect($permission)->each(function ($permission) { |
|
| 31 | + collect($permission)->each(function($permission) { |
|
| 32 | 32 | call_user_func([Permission::class, 'check'], $permission); |
| 33 | 33 | }); |
| 34 | 34 | |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | /** |
| 44 | 44 | * Fields from libphonenumber\PhoneNumber. |
| 45 | 45 | */ |
| 46 | - public $country_code; // 65 |
|
| 47 | - public $country_code_plus_sign; // +65 |
|
| 46 | + public $country_code; // 65 |
|
| 47 | + public $country_code_plus_sign; // +65 |
|
| 48 | 48 | public $national_number; |
| 49 | 49 | public $extension; |
| 50 | - public $country_code_source; // 0 |
|
| 51 | - public $country_code_source_text; // FROM_NUMBER_WITH_PLUS_SIGN |
|
| 50 | + public $country_code_source; // 0 |
|
| 51 | + public $country_code_source_text; // FROM_NUMBER_WITH_PLUS_SIGN |
|
| 52 | 52 | public $preferred_domestic_carrier_code; |
| 53 | 53 | public $raw_input; |
| 54 | 54 | public $raw_input_country; |
@@ -59,24 +59,24 @@ discard block |
||
| 59 | 59 | public $is_possible_number = false; |
| 60 | 60 | public $is_valid_number = false; |
| 61 | 61 | public $is_mobile_number = false; |
| 62 | - public $region_code_for_number; // SG |
|
| 63 | - public $number_type; // 1 |
|
| 64 | - public $number_type_text; // MOBILE |
|
| 62 | + public $region_code_for_number; // SG |
|
| 63 | + public $number_type; // 1 |
|
| 64 | + public $number_type_text; // MOBILE |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * From Formatting. |
| 68 | 68 | */ |
| 69 | - public $format_e164; // +6590919293 |
|
| 70 | - public $format_national; // 9091 9293 |
|
| 71 | - public $format_international; // +65 9091 9293 |
|
| 72 | - public $format_rfc3966; // tel:+65-9091-9293 |
|
| 69 | + public $format_e164; // +6590919293 |
|
| 70 | + public $format_national; // 9091 9293 |
|
| 71 | + public $format_international; // +65 9091 9293 |
|
| 72 | + public $format_rfc3966; // tel:+65-9091-9293 |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * From additional. |
| 76 | 76 | */ |
| 77 | - public $description; // Singapore |
|
| 78 | - public $carrier_name; // M1 |
|
| 79 | - public $timezones; // Asia/Singapore |
|
| 77 | + public $description; // Singapore |
|
| 78 | + public $carrier_name; // M1 |
|
| 79 | + public $timezones; // Asia/Singapore |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * PhoneNumberModel constructor. |