diff --git a/app/Application.php b/app/Application.php index 97105e479..499fdeaa6 100644 --- a/app/Application.php +++ b/app/Application.php @@ -20,5 +20,4 @@ class Application extends \Illuminate\Foundation\Application . 'Config' . ($path ? DIRECTORY_SEPARATOR.$path : $path); } - -} \ No newline at end of file +} diff --git a/app/Auth/Access/EmailConfirmationService.php b/app/Auth/Access/EmailConfirmationService.php index a94c54d19..9aa3b9b98 100644 --- a/app/Auth/Access/EmailConfirmationService.php +++ b/app/Auth/Access/EmailConfirmationService.php @@ -36,5 +36,4 @@ class EmailConfirmationService extends UserTokenService return setting('registration-confirmation') || setting('registration-restrict'); } - } diff --git a/app/Auth/Access/UserInviteService.php b/app/Auth/Access/UserInviteService.php index 8e04d7b22..20519fc7d 100644 --- a/app/Auth/Access/UserInviteService.php +++ b/app/Auth/Access/UserInviteService.php @@ -19,5 +19,4 @@ class UserInviteService extends UserTokenService $token = $this->createTokenForUser($user); $user->notify(new UserInvite($token)); } - } diff --git a/app/Auth/Access/UserTokenService.php b/app/Auth/Access/UserTokenService.php index 09a2f761b..a1defbf62 100644 --- a/app/Auth/Access/UserTokenService.php +++ b/app/Auth/Access/UserTokenService.php @@ -131,5 +131,4 @@ class UserTokenService return Carbon::now()->subHours($this->expiryTime) ->gt(new Carbon($tokenEntry->created_at)); } - -} \ No newline at end of file +} diff --git a/app/Config/auth.php b/app/Config/auth.php index cd74c2739..5535a6f9c 100644 --- a/app/Config/auth.php +++ b/app/Config/auth.php @@ -70,4 +70,4 @@ return [ ], ], -]; \ No newline at end of file +]; diff --git a/app/Config/cache.php b/app/Config/cache.php index 6d8fa7ad7..33d3a1a0b 100644 --- a/app/Config/cache.php +++ b/app/Config/cache.php @@ -14,8 +14,12 @@ if (env('CACHE_DRIVER') === 'memcached') { $memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ',')); foreach ($memcachedServers as $index => $memcachedServer) { $memcachedServerDetails = explode(':', $memcachedServer); - if (count($memcachedServerDetails) < 2) $memcachedServerDetails[] = '11211'; - if (count($memcachedServerDetails) < 3) $memcachedServerDetails[] = '100'; + if (count($memcachedServerDetails) < 2) { + $memcachedServerDetails[] = '11211'; + } + if (count($memcachedServerDetails) < 3) { + $memcachedServerDetails[] = '100'; + } $memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails); } } diff --git a/app/Config/database.php b/app/Config/database.php index a98b46a2c..ed654ffb9 100644 --- a/app/Config/database.php +++ b/app/Config/database.php @@ -11,7 +11,6 @@ // REDIS // Split out configuration into an array if (env('REDIS_SERVERS', false)) { - $redisDefaults = ['host' => '127.0.0.1', 'port' => '6379', 'database' => '0', 'password' => null]; $redisServers = explode(',', trim(env('REDIS_SERVERS', '127.0.0.1:6379:0'), ',')); $redisConfig = ['client' => 'predis']; diff --git a/app/Config/dompdf.php b/app/Config/dompdf.php index 77f0cff9c..87be53df5 100644 --- a/app/Config/dompdf.php +++ b/app/Config/dompdf.php @@ -69,7 +69,7 @@ return [ * should be an absolute path. * This is only checked on command line call by dompdf.php, but not by * direct class use like: - * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); + * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); */ "DOMPDF_CHROOT" => realpath(base_path()), diff --git a/app/Config/hashing.php b/app/Config/hashing.php index edcc7c1da..756718ce2 100644 --- a/app/Config/hashing.php +++ b/app/Config/hashing.php @@ -34,4 +34,4 @@ return [ 'time' => 2, ], -]; \ No newline at end of file +]; diff --git a/app/Config/logging.php b/app/Config/logging.php index 9c3218a01..0b55dc24d 100644 --- a/app/Config/logging.php +++ b/app/Config/logging.php @@ -79,4 +79,4 @@ return [ ], ], -]; \ No newline at end of file +]; diff --git a/app/Config/mail.php b/app/Config/mail.php index dfb41e7e6..a91bdf237 100644 --- a/app/Config/mail.php +++ b/app/Config/mail.php @@ -23,7 +23,7 @@ return [ // Global "From" address & name 'from' => [ 'address' => env('MAIL_FROM', 'mail@bookstackapp.com'), - 'name' => env('MAIL_FROM_NAME','BookStack') + 'name' => env('MAIL_FROM_NAME', 'BookStack') ], // Email encryption protocol diff --git a/app/Config/services.php b/app/Config/services.php index 2136f8116..923015f6e 100644 --- a/app/Config/services.php +++ b/app/Config/services.php @@ -81,8 +81,8 @@ return [ 'okta' => [ 'client_id' => env('OKTA_APP_ID'), 'client_secret' => env('OKTA_APP_SECRET'), - 'redirect' => env('APP_URL') . '/login/service/okta/callback', - 'base_url' => env('OKTA_BASE_URL'), + 'redirect' => env('APP_URL') . '/login/service/okta/callback', + 'base_url' => env('OKTA_BASE_URL'), 'name' => 'Okta', 'auto_register' => env('OKTA_AUTO_REGISTER', false), 'auto_confirm' => env('OKTA_AUTO_CONFIRM_EMAIL', false), @@ -126,10 +126,10 @@ return [ 'email_attribute' => env('LDAP_EMAIL_ATTRIBUTE', 'mail'), 'display_name_attribute' => env('LDAP_DISPLAY_NAME_ATTRIBUTE', 'cn'), 'follow_referrals' => env('LDAP_FOLLOW_REFERRALS', false), - 'user_to_groups' => env('LDAP_USER_TO_GROUPS',false), - 'group_attribute' => env('LDAP_GROUP_ATTRIBUTE', 'memberOf'), - 'remove_from_groups' => env('LDAP_REMOVE_FROM_GROUPS',false), - 'tls_insecure' => env('LDAP_TLS_INSECURE', false), - ] + 'user_to_groups' => env('LDAP_USER_TO_GROUPS', false), + 'group_attribute' => env('LDAP_GROUP_ATTRIBUTE', 'memberOf'), + 'remove_from_groups' => env('LDAP_REMOVE_FROM_GROUPS', false), + 'tls_insecure' => env('LDAP_TLS_INSECURE', false), + ] ]; diff --git a/app/Config/setting-defaults.php b/app/Config/setting-defaults.php index 4a135573b..c6080df1d 100644 --- a/app/Config/setting-defaults.php +++ b/app/Config/setting-defaults.php @@ -19,4 +19,4 @@ return [ 'app-custom-head' => false, 'registration-enabled' => false, -]; \ No newline at end of file +]; diff --git a/app/Entities/Repos/PageRepo.php b/app/Entities/Repos/PageRepo.php index ed142eb61..a7daf549b 100644 --- a/app/Entities/Repos/PageRepo.php +++ b/app/Entities/Repos/PageRepo.php @@ -432,7 +432,7 @@ class PageRepo extends EntityRepo return []; } - $tree = collect($headers)->map(function($header) { + $tree = collect($headers)->map(function ($header) { $text = trim(str_replace("\xc2\xa0", '', $header->nodeValue)); $text = mb_substr($text, 0, 100); @@ -442,7 +442,7 @@ class PageRepo extends EntityRepo 'link' => '#' . $header->getAttribute('id'), 'text' => $text, ]; - })->filter(function($header) { + })->filter(function ($header) { return mb_strlen($header['text']) > 0; }); @@ -541,12 +541,12 @@ class PageRepo extends EntityRepo * @param string $search * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ - public function getPageTemplates(int $count = 10, int $page = 1, string $search = '') + public function getPageTemplates(int $count = 10, int $page = 1, string $search = '') { $query = $this->entityQuery('page') ->where('template', '=', true) ->orderBy('name', 'asc') - ->skip( ($page - 1) * $count) + ->skip(($page - 1) * $count) ->take($count); if ($search) { diff --git a/app/Exceptions/UserTokenExpiredException.php b/app/Exceptions/UserTokenExpiredException.php index 203e08c85..e19707457 100644 --- a/app/Exceptions/UserTokenExpiredException.php +++ b/app/Exceptions/UserTokenExpiredException.php @@ -1,6 +1,7 @@ userId = $userId; parent::__construct($message); } - - -} \ No newline at end of file +} diff --git a/app/Exceptions/UserTokenNotFoundException.php b/app/Exceptions/UserTokenNotFoundException.php index 08c1fd830..3ed53f72a 100644 --- a/app/Exceptions/UserTokenNotFoundException.php +++ b/app/Exceptions/UserTokenNotFoundException.php @@ -1,3 +1,6 @@ emailConfirmationService->checkTokenAndGetUserId($token); } catch (Exception $exception) { - if ($exception instanceof UserTokenNotFoundException) { session()->flash('error', trans('errors.email_confirmation_invalid')); return redirect('/register'); @@ -114,5 +113,4 @@ class ConfirmEmailController extends Controller session()->flash('success', trans('auth.email_confirm_resent')); return redirect('/register/confirm'); } - } diff --git a/app/Http/Controllers/Auth/UserInviteController.php b/app/Http/Controllers/Auth/UserInviteController.php index cfeb69648..a7b9f597f 100644 --- a/app/Http/Controllers/Auth/UserInviteController.php +++ b/app/Http/Controllers/Auth/UserInviteController.php @@ -102,5 +102,4 @@ class UserInviteController extends Controller throw $exception; } - } diff --git a/app/Http/Controllers/PageTemplateController.php b/app/Http/Controllers/PageTemplateController.php index 05943351a..b47205a1b 100644 --- a/app/Http/Controllers/PageTemplateController.php +++ b/app/Http/Controllers/PageTemplateController.php @@ -59,5 +59,4 @@ class PageTemplateController extends Controller 'markdown' => $page->markdown, ]); } - } diff --git a/app/Http/Middleware/CheckForMaintenanceMode.php b/app/Http/Middleware/CheckForMaintenanceMode.php index 4b4bacd83..0c7683836 100644 --- a/app/Http/Middleware/CheckForMaintenanceMode.php +++ b/app/Http/Middleware/CheckForMaintenanceMode.php @@ -14,4 +14,4 @@ class CheckForMaintenanceMode extends Middleware protected $except = [ // ]; -} \ No newline at end of file +} diff --git a/app/Http/Request.php b/app/Http/Request.php index bd2761a0b..183686f67 100644 --- a/app/Http/Request.php +++ b/app/Http/Request.php @@ -22,5 +22,4 @@ class Request extends LaravelRequest return $base; } - -} \ No newline at end of file +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b46a716cc..3a1b4f42e 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -48,7 +48,7 @@ class AppServiceProvider extends ServiceProvider return ""; }); - Blade::directive('exposeTranslations', function($expression) { + Blade::directive('exposeTranslations', function ($expression) { return "startPush('translations'); ?>" . "" . '' . "\n" . diff --git a/app/helpers.php b/app/helpers.php index 59b9104f8..d14379ddd 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -12,7 +12,7 @@ use BookStack\Settings\SettingService; * @return string * @throws Exception */ -function versioned_asset($file = '') : string +function versioned_asset(string $file = ''): string { static $version = null; @@ -35,7 +35,7 @@ function versioned_asset($file = '') : string * Defaults to public 'Guest' user if not logged in. * @return User */ -function user() : User +function user(): User { return auth()->user() ?: User::getDefault(); } @@ -44,7 +44,7 @@ function user() : User * Check if current user is a signed in user. * @return bool */ -function signedInUser() : bool +function signedInUser(): bool { return auth()->user() && !auth()->user()->isDefault(); } @@ -53,7 +53,7 @@ function signedInUser() : bool * Check if the current user has general access. * @return bool */ -function hasAppAccess() : bool +function hasAppAccess(): bool { return !auth()->guest() || setting('app-public'); } @@ -66,7 +66,7 @@ function hasAppAccess() : bool * @param Ownable $ownable * @return bool */ -function userCan(string $permission, Ownable $ownable = null) : bool +function userCan(string $permission, Ownable $ownable = null): bool { if ($ownable === null) { return user() && user()->can($permission); @@ -84,7 +84,7 @@ function userCan(string $permission, Ownable $ownable = null) : bool * @param string|null $entityClass * @return bool */ -function userCanOnAny(string $permission, string $entityClass = null) : bool +function userCanOnAny(string $permission, string $entityClass = null): bool { $permissionService = app(PermissionService::class); return $permissionService->checkUserHasPermissionOnAnything($permission, $entityClass); @@ -96,7 +96,7 @@ function userCanOnAny(string $permission, string $entityClass = null) : bool * @param bool $default * @return bool|string|SettingService */ -function setting($key = null, $default = false) +function setting(string $key = null, bool $default = false) { $settingService = resolve(SettingService::class); if (is_null($key)) { @@ -110,7 +110,7 @@ function setting($key = null, $default = false) * @param string $path * @return string */ -function theme_path($path = '') : string +function theme_path(string $path = ''): string { $theme = config('view.theme'); if (!$theme) { @@ -130,7 +130,7 @@ function theme_path($path = '') : string * @param array $attrs * @return mixed */ -function icon($name, $attrs = []) +function icon(string $name, array $attrs = []): string { $attrs = array_merge([ 'class' => 'svg-icon', @@ -158,12 +158,12 @@ function icon($name, $attrs = []) * Generate a url with multiple parameters for sorting purposes. * Works out the logic to set the correct sorting direction * Discards empty parameters and allows overriding. - * @param $path + * @param string $path * @param array $data * @param array $overrideData * @return string */ -function sortUrl($path, $data, $overrideData = []) +function sortUrl(string $path, array $data, array $overrideData = []): string { $queryStringSections = []; $queryData = array_merge($data, $overrideData);