]> BookStack Code Mirror - bookstack/commitdiff
Ran phpcbf and updated helpers typehinting
authorDan Brown <redacted>
Sun, 15 Sep 2019 17:29:51 +0000 (18:29 +0100)
committerDan Brown <redacted>
Sun, 15 Sep 2019 17:29:51 +0000 (18:29 +0100)
23 files changed:
app/Application.php
app/Auth/Access/EmailConfirmationService.php
app/Auth/Access/UserInviteService.php
app/Auth/Access/UserTokenService.php
app/Config/auth.php
app/Config/cache.php
app/Config/database.php
app/Config/dompdf.php
app/Config/hashing.php
app/Config/logging.php
app/Config/mail.php
app/Config/services.php
app/Config/setting-defaults.php
app/Entities/Repos/PageRepo.php
app/Exceptions/UserTokenExpiredException.php
app/Exceptions/UserTokenNotFoundException.php
app/Http/Controllers/Auth/ConfirmEmailController.php
app/Http/Controllers/Auth/UserInviteController.php
app/Http/Controllers/PageTemplateController.php
app/Http/Middleware/CheckForMaintenanceMode.php
app/Http/Request.php
app/Providers/AppServiceProvider.php
app/helpers.php

index 97105e47990c5a2d504ee5ae92c20daa5fd64fc9..499fdeaa691ce8a0442b2494c9f46b09edf42f27 100644 (file)
@@ -20,5 +20,4 @@ class Application extends \Illuminate\Foundation\Application
             . 'Config'
             . ($path ? DIRECTORY_SEPARATOR.$path : $path);
     }
-
-}
\ No newline at end of file
+}
index a94c54d19b4258c7e6fd771c4fdf71c9aa11df1a..9aa3b9b98b56cf0d56453ae9e2de18c48c4d4524 100644 (file)
@@ -36,5 +36,4 @@ class EmailConfirmationService extends UserTokenService
         return setting('registration-confirmation')
             || setting('registration-restrict');
     }
-
 }
index 8e04d7b224b6039fb0c843e343aee9a1958dd371..20519fc7d4b98ae9f772a5387deb7fdfe9b84984 100644 (file)
@@ -19,5 +19,4 @@ class UserInviteService extends UserTokenService
         $token = $this->createTokenForUser($user);
         $user->notify(new UserInvite($token));
     }
-
 }
index 09a2f761b8f31ac73ae269ca9c6c7f21cf34d59b..a1defbf62d439a4bdacdef971271db1dde532afd 100644 (file)
@@ -131,5 +131,4 @@ class UserTokenService
         return Carbon::now()->subHours($this->expiryTime)
             ->gt(new Carbon($tokenEntry->created_at));
     }
-
-}
\ No newline at end of file
+}
index cd74c2739dfee48449f2893e6354decbcd6648ee..5535a6f9ce88b1c5ea6fd972d212f00337dfdb24 100644 (file)
@@ -70,4 +70,4 @@ return [
         ],
     ],
 
-];
\ No newline at end of file
+];
index 6d8fa7ad7ea0d1486c0fbbb39aa95fe7e0392ff1..33d3a1a0bb7b02e6471f1088492fa7b5078e0519 100644 (file)
@@ -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);
     }
 }
index a98b46a2c7c54105cd3fff34f538f6d23a8145dc..ed654ffb9172b4789a62c922d971adb8f550976d 100644 (file)
@@ -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'];
index 77f0cff9c73738cd40eb61c54fe56b3053a5c76a..87be53df52b373d7c701a590f3051c7066fff711 100644 (file)
@@ -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()),
 
index edcc7c1daf64d62523485168b148db090e76b64b..756718ce2bd7239fdd63720661a679db103e6501 100644 (file)
@@ -34,4 +34,4 @@ return [
         'time' => 2,
     ],
 
-];
\ No newline at end of file
+];
index 9c3218a01c99fe6136f70f6c019b085f2f51462d..0b55dc24db921f55bb01460fe249560349736c4f 100644 (file)
@@ -79,4 +79,4 @@ return [
         ],
     ],
 
-];
\ No newline at end of file
+];
index dfb41e7e6c5c1d0e839330ca997bd27d56bd2d08..a91bdf23797ef182325da8f49d621d541f1bc8d2 100644 (file)
@@ -23,7 +23,7 @@ return [
     // Global "From" address & name
     'from' => [
         'address' => env('MAIL_FROM', '[email protected]'),
-        'name' => env('MAIL_FROM_NAME','BookStack')
+        'name' => env('MAIL_FROM_NAME', 'BookStack')
     ],
 
     // Email encryption protocol
index 2136f8116f489879776901b29a94ad886ef39a1f..923015f6e62815e66b388a21f6e9d4b0b2282388 100644 (file)
@@ -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),
+    ]
 
 ];
index 4a135573bd5ba78cfd7bc814fc1ec9c2489698c0..c6080df1db6df81b434a935dde272c0f038c5c0a 100644 (file)
@@ -19,4 +19,4 @@ return [
     'app-custom-head'      => false,
     'registration-enabled' => false,
 
-];
\ No newline at end of file
+];
index ed142eb611b53f3d715722ded3bf12bdb2e4455f..a7daf549bcde29a46e20346dc3b38a28f1d90bb4 100644 (file)
@@ -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) {
index 203e08c8573100786f00728cc65d6c4b7c74b0a0..e19707457a33e47bfee00c944b667bdd9af60a5c 100644 (file)
@@ -1,6 +1,7 @@
 <?php namespace BookStack\Exceptions;
 
-class UserTokenExpiredException extends \Exception {
+class UserTokenExpiredException extends \Exception
+{
 
     public $userId;
 
@@ -14,6 +15,4 @@ class UserTokenExpiredException extends \Exception {
         $this->userId = $userId;
         parent::__construct($message);
     }
-
-
-}
\ No newline at end of file
+}
index 08c1fd830d167a5b875deba746e7ec2a2fa7d77d..3ed53f72ab42e706db04e51cc9a23b48f45e11c6 100644 (file)
@@ -1,3 +1,6 @@
 <?php namespace BookStack\Exceptions;
 
-class UserTokenNotFoundException extends \Exception {}
\ No newline at end of file
+class UserTokenNotFoundException extends \Exception
+{
+
+}
index 3e240b94efa845385320d0b48fc17b8a5b2edfaf..4300ab458cd9a77ddd046006e4e04c05311f1c19 100644 (file)
@@ -64,7 +64,6 @@ class ConfirmEmailController extends Controller
         try {
             $userId = $this->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');
     }
-
 }
index cfeb696482bdb8ad9df88d1c7c2fc4efa77bb362..a7b9f597f406c954d8d2e40a30fa6835eac1308f 100644 (file)
@@ -102,5 +102,4 @@ class UserInviteController extends Controller
 
         throw $exception;
     }
-
 }
index 05943351a06f1b47a7ba36e6052eabd215e73094..b47205a1ba3ad0ddfc8c6984b0e8b8c8f65f7a0f 100644 (file)
@@ -59,5 +59,4 @@ class PageTemplateController extends Controller
             'markdown' => $page->markdown,
         ]);
     }
-
 }
index 4b4bacd83c871e51f5462f66e80abc6e7fbfed74..0c76838367e3adc9bb7336a6938b24fb0dfdda45 100644 (file)
@@ -14,4 +14,4 @@ class CheckForMaintenanceMode extends Middleware
     protected $except = [
         //
     ];
-}
\ No newline at end of file
+}
index bd2761a0b5cfcd9fe8f8dec6149ddf0a3a9e5315..183686f67b4eef3a6299c2cb2e25893b4f4c4a61 100644 (file)
@@ -22,5 +22,4 @@ class Request extends LaravelRequest
 
         return $base;
     }
-
-}
\ No newline at end of file
+}
index b46a716cc4e0e985b287f233437b66eafcca7357..3a1b4f42ee63e02118a72d798d8e837f12499018 100644 (file)
@@ -48,7 +48,7 @@ class AppServiceProvider extends ServiceProvider
             return "<?php echo icon($expression); ?>";
         });
 
-        Blade::directive('exposeTranslations', function($expression) {
+        Blade::directive('exposeTranslations', function ($expression) {
             return "<?php \$__env->startPush('translations'); ?>" .
                 "<?php foreach({$expression} as \$key): ?>" .
                 '<meta name="translation" key="<?php echo e($key); ?>" value="<?php echo e(trans($key)); ?>">' . "\n" .
index 59b9104f8274c40badd5c56cc4981cfa3c9c3e8f..d14379ddd9364a7d5cf512ac73be9c66b106dcc5 100644 (file)
@@ -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);