]> BookStack Code Mirror - bookstack/blobdiff - app/Theming/ThemeService.php
Fixes for CodeStyle vol.2
[bookstack] / app / Theming / ThemeService.php
index cc68de1e17c6b3fc3ef6ba90c873f7bd4ec3d5e2..602abaf1c5a35e4845cbde67aec8981071271f5c 100644 (file)
@@ -1,4 +1,8 @@
-<?php namespace BookStack\Theming;
+<?php
+
+namespace BookStack\Theming;
+
+use BookStack\Auth\Access\SocialAuthService;
 
 class ThemeService
 {
@@ -24,6 +28,7 @@ class ThemeService
      *
      * If a callback returns a non-null value, this method will
      * stop and return that value itself.
+     *
      * @return mixed
      */
     public function dispatch(string $event, ...$args)
@@ -34,6 +39,7 @@ class ThemeService
                 return $result;
             }
         }
+
         return null;
     }
 
@@ -43,8 +49,17 @@ class ThemeService
     public function readThemeActions()
     {
         $themeActionsFile = theme_path('functions.php');
-        if (file_exists($themeActionsFile)) {
+        if ($themeActionsFile && file_exists($themeActionsFile)) {
             require $themeActionsFile;
         }
     }
-}
\ No newline at end of file
+
+    /**
+     * @see SocialAuthService::addSocialDriver
+     */
+    public function addSocialDriver(string $driverName, array $config, string $socialiteHandler, callable $configureForRedirect = null)
+    {
+        $socialAuthService = app()->make(SocialAuthService::class);
+        $socialAuthService->addSocialDriver($driverName, $config, $socialiteHandler, $configureForRedirect);
+    }
+}