From 257a5a23ecaf7ce779969d575ff8a0b976181d13 Mon Sep 17 00:00:00 2001 From: Dan Brown <ssddanbrown@googlemail.com> Date: Tue, 25 Sep 2018 16:58:03 +0100 Subject: [PATCH] Fleshed out entity provided and optimized imports --- app/Actions/ActivityService.php | 1 - app/Actions/CommentRepo.php | 1 - app/Actions/TagRepo.php | 2 +- app/Auth/Access/EmailConfirmationService.php | 6 +- app/Auth/Access/LdapService.php | 5 +- app/Auth/Access/SocialAuthService.php | 10 +-- app/Auth/Permissions/JointPermission.php | 2 +- app/Auth/Permissions/PermissionService.php | 7 +- app/Auth/Permissions/PermissionsRepo.php | 5 +- app/Auth/Role.php | 1 - app/Auth/SocialAccount.php | 1 - app/Auth/User.php | 4 +- app/Auth/UserRepo.php | 2 - app/Entities/Book.php | 1 - app/Entities/Chapter.php | 4 - app/Entities/Entity.php | 4 +- app/Entities/EntityProvider.php | 75 ++++++++++++++++++- app/Entities/EntityRepo.php | 13 +--- app/Entities/ExportService.php | 7 +- app/Entities/Page.php | 4 - app/Entities/PageRevision.php | 3 +- app/Entities/SearchService.php | 6 -- app/Exceptions/Handler.php | 10 +-- app/Http/Controllers/AttachmentController.php | 6 +- app/Http/Controllers/Auth/LoginController.php | 6 +- .../Controllers/Auth/RegisterController.php | 14 ++-- app/Http/Controllers/BookController.php | 2 +- app/Http/Controllers/BookshelfController.php | 3 +- app/Http/Controllers/ChapterController.php | 2 +- app/Http/Controllers/Controller.php | 4 +- app/Http/Controllers/HomeController.php | 1 - app/Http/Controllers/ImageController.php | 7 +- app/Http/Controllers/PageController.php | 6 +- app/Http/Controllers/PermissionController.php | 2 +- app/Http/Controllers/SearchController.php | 2 +- app/Http/Controllers/UserController.php | 7 +- app/Http/Middleware/TrustProxies.php | 2 +- app/Notifications/ConfirmEmail.php | 2 +- app/Notifications/ResetPassword.php | 2 +- app/Providers/AppServiceProvider.php | 2 +- app/Providers/BroadcastServiceProvider.php | 1 - app/Providers/CustomFacadeProvider.php | 12 +-- app/Providers/EventServiceProvider.php | 1 - app/Providers/LdapUserProvider.php | 2 - app/Providers/RouteServiceProvider.php | 1 - app/Settings/SettingService.php | 2 - app/Uploads/AttachmentService.php | 2 - app/Uploads/ImageRepo.php | 4 +- app/Uploads/ImageService.php | 8 +- 49 files changed, 144 insertions(+), 133 deletions(-) diff --git a/app/Actions/ActivityService.php b/app/Actions/ActivityService.php index 7b1046d22..37cd0a6a4 100644 --- a/app/Actions/ActivityService.php +++ b/app/Actions/ActivityService.php @@ -1,6 +1,5 @@ <?php namespace BookStack\Actions; -use BookStack\Actions\Activity; use BookStack\Auth\Permissions\PermissionService; use BookStack\Entities\Entity; use Session; diff --git a/app/Actions/CommentRepo.php b/app/Actions/CommentRepo.php index 3422d141b..5ff639e2e 100644 --- a/app/Actions/CommentRepo.php +++ b/app/Actions/CommentRepo.php @@ -1,6 +1,5 @@ <?php namespace BookStack\Actions; -use BookStack\Actions\Comment; use BookStack\Entities\Entity; /** diff --git a/app/Actions/TagRepo.php b/app/Actions/TagRepo.php index 87023674c..0cbfa4163 100644 --- a/app/Actions/TagRepo.php +++ b/app/Actions/TagRepo.php @@ -1,7 +1,7 @@ <?php namespace BookStack\Actions; -use BookStack\Entities\Entity; use BookStack\Auth\Permissions\PermissionService; +use BookStack\Entities\Entity; /** * Class TagRepo diff --git a/app/Auth/Access/EmailConfirmationService.php b/app/Auth/Access/EmailConfirmationService.php index b14eb8c3f..4df014116 100644 --- a/app/Auth/Access/EmailConfirmationService.php +++ b/app/Auth/Access/EmailConfirmationService.php @@ -1,11 +1,11 @@ <?php namespace BookStack\Auth\Access; -use BookStack\Notifications\ConfirmEmail; +use BookStack\Auth\User; use BookStack\Auth\UserRepo; -use Carbon\Carbon; use BookStack\Exceptions\ConfirmationEmailException; use BookStack\Exceptions\UserRegistrationException; -use BookStack\Auth\User; +use BookStack\Notifications\ConfirmEmail; +use Carbon\Carbon; use Illuminate\Database\Connection as Database; class EmailConfirmationService diff --git a/app/Auth/Access/LdapService.php b/app/Auth/Access/LdapService.php index 4fbf29365..d3a177f8e 100644 --- a/app/Auth/Access/LdapService.php +++ b/app/Auth/Access/LdapService.php @@ -1,11 +1,10 @@ <?php namespace BookStack\Auth\Access; use BookStack\Auth\Access; -use BookStack\Exceptions\LdapException; -use BookStack\Auth\UserRepo; use BookStack\Auth\Role; use BookStack\Auth\User; -use BookStack\Auth\Access\Ldap; +use BookStack\Auth\UserRepo; +use BookStack\Exceptions\LdapException; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\Eloquent\Builder; diff --git a/app/Auth/Access/SocialAuthService.php b/app/Auth/Access/SocialAuthService.php index 005380f5b..87db1d5c6 100644 --- a/app/Auth/Access/SocialAuthService.php +++ b/app/Auth/Access/SocialAuthService.php @@ -1,11 +1,11 @@ <?php namespace BookStack\Auth\Access; -use BookStack\Exceptions\SocialSignInAccountNotUsed; -use Laravel\Socialite\Contracts\Factory as Socialite; -use BookStack\Exceptions\SocialDriverNotConfigured; -use BookStack\Exceptions\UserRegistrationException; -use BookStack\Auth\UserRepo; use BookStack\Auth\SocialAccount; +use BookStack\Auth\UserRepo; +use BookStack\Exceptions\SocialDriverNotConfigured; +use BookStack\Exceptions\SocialSignInAccountNotUsed; +use BookStack\Exceptions\UserRegistrationException; +use Laravel\Socialite\Contracts\Factory as Socialite; use Laravel\Socialite\Contracts\User as SocialUser; class SocialAuthService diff --git a/app/Auth/Permissions/JointPermission.php b/app/Auth/Permissions/JointPermission.php index 71c1979fc..c48549b8f 100644 --- a/app/Auth/Permissions/JointPermission.php +++ b/app/Auth/Permissions/JointPermission.php @@ -1,8 +1,8 @@ <?php namespace BookStack\Auth\Permissions; +use BookStack\Auth\Role; use BookStack\Entities\Entity; use BookStack\Model; -use BookStack\Auth\Role; class JointPermission extends Model { diff --git a/app/Auth/Permissions/PermissionService.php b/app/Auth/Permissions/PermissionService.php index aae3980c1..a4b9103ba 100644 --- a/app/Auth/Permissions/PermissionService.php +++ b/app/Auth/Permissions/PermissionService.php @@ -1,16 +1,13 @@ <?php namespace BookStack\Auth\Permissions; use BookStack\Auth\Permissions; +use BookStack\Auth\Role; use BookStack\Entities\Book; use BookStack\Entities\Bookshelf; use BookStack\Entities\Chapter; use BookStack\Entities\Entity; -use BookStack\Auth\Permissions\EntityPermission; -use BookStack\Auth\Permissions\JointPermission; -use BookStack\Ownable; use BookStack\Entities\Page; -use BookStack\Auth\Role; -use BookStack\Auth\User; +use BookStack\Ownable; use Illuminate\Database\Connection; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\Builder as QueryBuilder; diff --git a/app/Auth/Permissions/PermissionsRepo.php b/app/Auth/Permissions/PermissionsRepo.php index 98a8a9f14..18d5089be 100644 --- a/app/Auth/Permissions/PermissionsRepo.php +++ b/app/Auth/Permissions/PermissionsRepo.php @@ -1,11 +1,8 @@ <?php namespace BookStack\Auth\Permissions; use BookStack\Auth\Permissions; -use BookStack\Exceptions\PermissionsException; -use BookStack\Auth\Permissions\RolePermission; use BookStack\Auth\Role; -use BookStack\Auth\Permissions\PermissionService; -use Setting; +use BookStack\Exceptions\PermissionsException; class PermissionsRepo { diff --git a/app/Auth/Role.php b/app/Auth/Role.php index b32954767..c8bb47e45 100644 --- a/app/Auth/Role.php +++ b/app/Auth/Role.php @@ -2,7 +2,6 @@ use BookStack\Auth\Permissions\JointPermission; use BookStack\Model; -use BookStack\Auth\Permissions\RolePermission; class Role extends Model { diff --git a/app/Auth/SocialAccount.php b/app/Auth/SocialAccount.php index 7d0dbaafc..804dbe629 100644 --- a/app/Auth/SocialAccount.php +++ b/app/Auth/SocialAccount.php @@ -1,6 +1,5 @@ <?php namespace BookStack\Auth; -use BookStack\Auth\User; use BookStack\Model; class SocialAccount extends Model diff --git a/app/Auth/User.php b/app/Auth/User.php index 0f3de122c..05e77e13d 100644 --- a/app/Auth/User.php +++ b/app/Auth/User.php @@ -1,10 +1,8 @@ <?php namespace BookStack\Auth; -use BookStack\Uploads\Image; use BookStack\Model; use BookStack\Notifications\ResetPassword; -use BookStack\Auth\Role; -use BookStack\Auth\SocialAccount; +use BookStack\Uploads\Image; use Illuminate\Auth\Authenticatable; use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; diff --git a/app/Auth/UserRepo.php b/app/Auth/UserRepo.php index 87c0328d6..a46aba8db 100644 --- a/app/Auth/UserRepo.php +++ b/app/Auth/UserRepo.php @@ -4,8 +4,6 @@ use Activity; use BookStack\Entities\EntityRepo; use BookStack\Exceptions\NotFoundException; use BookStack\Uploads\Image; -use BookStack\Auth\Role; -use BookStack\Auth\User; use Exception; use Images; diff --git a/app/Entities/Book.php b/app/Entities/Book.php index b8a29322d..5ab5142c9 100644 --- a/app/Entities/Book.php +++ b/app/Entities/Book.php @@ -1,7 +1,6 @@ <?php namespace BookStack\Entities; use BookStack\Uploads\Image; -use BookStack\Entities\Page; class Book extends Entity { diff --git a/app/Entities/Chapter.php b/app/Entities/Chapter.php index 8638e3c9e..079105ba9 100644 --- a/app/Entities/Chapter.php +++ b/app/Entities/Chapter.php @@ -1,9 +1,5 @@ <?php namespace BookStack\Entities; -use BookStack\Entities\Book; -use BookStack\Entities\Entity; -use BookStack\Entities\Page; - class Chapter extends Entity { public $searchFactor = 1.3; diff --git a/app/Entities/Entity.php b/app/Entities/Entity.php index 87d679fdb..24c80afc5 100644 --- a/app/Entities/Entity.php +++ b/app/Entities/Entity.php @@ -2,11 +2,11 @@ use BookStack\Actions\Activity; use BookStack\Actions\Comment; +use BookStack\Actions\Tag; +use BookStack\Actions\View; use BookStack\Auth\Permissions\EntityPermission; use BookStack\Auth\Permissions\JointPermission; use BookStack\Ownable; -use BookStack\Actions\Tag; -use BookStack\Actions\View; use Illuminate\Database\Eloquent\Relations\MorphMany; class Entity extends Ownable diff --git a/app/Entities/EntityProvider.php b/app/Entities/EntityProvider.php index 51e3ad060..0442b9f44 100644 --- a/app/Entities/EntityProvider.php +++ b/app/Entities/EntityProvider.php @@ -1,7 +1,78 @@ <?php namespace BookStack\Entities; - +/** + * Class EntityProvider + * + * Provides access to the core entity models. + * Wrapped up in this provider since they are often used together + * so this is a neater alternative to injecting all in individually. + * + * @package BookStack\Entities + */ class EntityProvider { - // TODO - + + /** + * @var Bookshelf + */ + protected $bookshelf; + + /** + * @var Book + */ + protected $book; + + /** + * @var Chapter + */ + protected $chapter; + + /** + * @var Page + */ + protected $page; + + /** + * @var PageRevision + */ + protected $pageRevision; + + /** + * EntityProvider constructor. + * @param Bookshelf $bookshelf + * @param Book $book + * @param Chapter $chapter + * @param Page $page + * @param PageRevision $pageRevision + */ + public function __construct( + Bookshelf $bookshelf, + Book $book, + Chapter $chapter, + Page $page, + PageRevision $pageRevision + ) { + $this->bookshelf = $bookshelf; + $this->book = $book; + $this->chapter = $chapter; + $this->page = $page; + $this->pageRevision = $pageRevision; + } + + /** + * Fetch all core entity types as an associated array + * with their basic names as the keys. + * @return Entity[] + */ + public function all() + { + return [ + 'bookshelf' => $this->bookshelf, + 'book' => $this->book, + 'chapter' => $this->chapter, + 'page' => $this->page, + ]; + } + + } \ No newline at end of file diff --git a/app/Entities/EntityRepo.php b/app/Entities/EntityRepo.php index 2031807ee..e2fe2307e 100644 --- a/app/Entities/EntityRepo.php +++ b/app/Entities/EntityRepo.php @@ -1,18 +1,11 @@ <?php namespace BookStack\Entities; -use BookStack\Entities\Book; -use BookStack\Entities\Bookshelf; -use BookStack\Entities\Chapter; -use BookStack\Entities\Entity; +use BookStack\Actions\TagRepo; +use BookStack\Actions\ViewService; +use BookStack\Auth\Permissions\PermissionService; use BookStack\Exceptions\NotFoundException; use BookStack\Exceptions\NotifyException; -use BookStack\Entities\Page; -use BookStack\Entities\PageRevision; -use BookStack\Actions\TagRepo; use BookStack\Uploads\AttachmentService; -use BookStack\Auth\Permissions\PermissionService; -use BookStack\Entities\SearchService; -use BookStack\Actions\ViewService; use Carbon\Carbon; use DOMDocument; use DOMXPath; diff --git a/app/Entities/ExportService.php b/app/Entities/ExportService.php index fc0e4d114..e12e14f8b 100644 --- a/app/Entities/ExportService.php +++ b/app/Entities/ExportService.php @@ -1,9 +1,5 @@ <?php namespace BookStack\Entities; -use BookStack\Entities\Book; -use BookStack\Entities\Chapter; -use BookStack\Entities\Page; -use BookStack\Entities\EntityRepo; use BookStack\Uploads\ImageService; class ExportService @@ -14,7 +10,8 @@ class ExportService /** * ExportService constructor. - * @param $entityRepo + * @param EntityRepo $entityRepo + * @param ImageService $imageService */ public function __construct(EntityRepo $entityRepo, ImageService $imageService) { diff --git a/app/Entities/Page.php b/app/Entities/Page.php index 59de338cb..ea7df16f4 100644 --- a/app/Entities/Page.php +++ b/app/Entities/Page.php @@ -1,10 +1,6 @@ <?php namespace BookStack\Entities; use BookStack\Uploads\Attachment; -use BookStack\Entities\Book; -use BookStack\Entities\Chapter; -use BookStack\Entities\Entity; -use BookStack\Entities\PageRevision; class Page extends Entity { diff --git a/app/Entities/PageRevision.php b/app/Entities/PageRevision.php index 502a71588..d30147bfc 100644 --- a/app/Entities/PageRevision.php +++ b/app/Entities/PageRevision.php @@ -1,8 +1,7 @@ <?php namespace BookStack\Entities; -use BookStack\Entities\Page; -use BookStack\Model; use BookStack\Auth\User; +use BookStack\Model; class PageRevision extends Model { diff --git a/app/Entities/SearchService.php b/app/Entities/SearchService.php index 0bfdab7ea..91e8a28e9 100644 --- a/app/Entities/SearchService.php +++ b/app/Entities/SearchService.php @@ -1,11 +1,5 @@ <?php namespace BookStack\Entities; -use BookStack\Entities\Book; -use BookStack\Entities\Bookshelf; -use BookStack\Entities\Chapter; -use BookStack\Entities\Entity; -use BookStack\Entities\Page; -use BookStack\Entities\SearchTerm; use BookStack\Auth\Permissions\PermissionService; use Illuminate\Database\Connection; use Illuminate\Database\Query\Builder; diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 0eb62dc31..70a534975 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -3,12 +3,12 @@ namespace BookStack\Exceptions; use Exception; -use Illuminate\Auth\AuthenticationException; -use Illuminate\Validation\ValidationException; -use Illuminate\Database\Eloquent\ModelNotFoundException; -use Symfony\Component\HttpKernel\Exception\HttpException; -use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Auth\Access\AuthorizationException; +use Illuminate\Auth\AuthenticationException; +use Illuminate\Database\Eloquent\ModelNotFoundException; +use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Illuminate\Validation\ValidationException; +use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class Handler extends ExceptionHandler diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 535543177..14a1b9f3a 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -1,9 +1,9 @@ <?php namespace BookStack\Http\Controllers; -use BookStack\Exceptions\FileUploadException; -use BookStack\Uploads\Attachment; -use BookStack\Exceptions\NotFoundException; use BookStack\Entities\EntityRepo; +use BookStack\Exceptions\FileUploadException; +use BookStack\Exceptions\NotFoundException; +use BookStack\Uploads\Attachment; use BookStack\Uploads\AttachmentService; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 8ef46c298..e820154e7 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,11 +2,11 @@ namespace BookStack\Http\Controllers\Auth; -use BookStack\Exceptions\AuthException; -use BookStack\Http\Controllers\Controller; -use BookStack\Auth\UserRepo; use BookStack\Auth\Access\LdapService; use BookStack\Auth\Access\SocialAuthService; +use BookStack\Auth\UserRepo; +use BookStack\Exceptions\AuthException; +use BookStack\Http\Controllers\Controller; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index dd60c7416..cdcca116c 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,21 +2,19 @@ namespace BookStack\Http\Controllers\Auth; +use BookStack\Auth\SocialAccount; +use BookStack\Auth\User; +use BookStack\Auth\UserRepo; use BookStack\Exceptions\SocialSignInAccountNotUsed; use BookStack\Exceptions\SocialSignInException; use BookStack\Exceptions\UserRegistrationException; -use BookStack\Auth\UserRepo; -use BookStack\Auth\Access\EmailConfirmationService; -use BookStack\Auth\Access\SocialAuthService; -use BookStack\Auth\SocialAccount; -use BookStack\Auth\User; +use BookStack\Http\Controllers\Controller; use Exception; +use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Http\Request; use Illuminate\Http\Response; -use Validator; -use BookStack\Http\Controllers\Controller; -use Illuminate\Foundation\Auth\RegistersUsers; use Laravel\Socialite\Contracts\User as SocialUser; +use Validator; class RegisterController extends Controller { diff --git a/app/Http/Controllers/BookController.php b/app/Http/Controllers/BookController.php index 045bcd344..5a9eadaf8 100644 --- a/app/Http/Controllers/BookController.php +++ b/app/Http/Controllers/BookController.php @@ -1,9 +1,9 @@ <?php namespace BookStack\Http\Controllers; use Activity; +use BookStack\Auth\UserRepo; use BookStack\Entities\Book; use BookStack\Entities\EntityRepo; -use BookStack\Auth\UserRepo; use BookStack\Entities\ExportService; use Illuminate\Http\Request; use Illuminate\Http\Response; diff --git a/app/Http/Controllers/BookshelfController.php b/app/Http/Controllers/BookshelfController.php index c1938d754..09dd468d0 100644 --- a/app/Http/Controllers/BookshelfController.php +++ b/app/Http/Controllers/BookshelfController.php @@ -1,10 +1,9 @@ <?php namespace BookStack\Http\Controllers; use Activity; -use BookStack\Entities\Book; +use BookStack\Auth\UserRepo; use BookStack\Entities\Bookshelf; use BookStack\Entities\EntityRepo; -use BookStack\Auth\UserRepo; use BookStack\Entities\ExportService; use Illuminate\Http\Request; use Illuminate\Http\Response; diff --git a/app/Http/Controllers/ChapterController.php b/app/Http/Controllers/ChapterController.php index a3f26f7cd..88a89ebf3 100644 --- a/app/Http/Controllers/ChapterController.php +++ b/app/Http/Controllers/ChapterController.php @@ -1,8 +1,8 @@ <?php namespace BookStack\Http\Controllers; use Activity; -use BookStack\Entities\EntityRepo; use BookStack\Auth\UserRepo; +use BookStack\Entities\EntityRepo; use BookStack\Entities\ExportService; use Illuminate\Http\Request; use Illuminate\Http\Response; diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 9c1527e98..80f567eaa 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,13 +2,13 @@ namespace BookStack\Http\Controllers; +use BookStack\Auth\User; use BookStack\Ownable; use Illuminate\Foundation\Bus\DispatchesJobs; +use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Http\Request; use Illuminate\Routing\Controller as BaseController; -use Illuminate\Foundation\Validation\ValidatesRequests; -use BookStack\Auth\User; abstract class Controller extends BaseController { diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index e9469fafb..4d536c1b3 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,7 +2,6 @@ use Activity; use BookStack\Entities\EntityRepo; -use Illuminate\Http\Request; use Illuminate\Http\Response; use Views; diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index a64608e8e..33ff5d236 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -1,13 +1,12 @@ <?php namespace BookStack\Http\Controllers; -use BookStack\Exceptions\ImageUploadException; -use BookStack\Exceptions\NotFoundException; use BookStack\Entities\EntityRepo; +use BookStack\Exceptions\ImageUploadException; +use BookStack\Repos\PageRepo; +use BookStack\Uploads\Image; use BookStack\Uploads\ImageRepo; use Illuminate\Filesystem\Filesystem as File; use Illuminate\Http\Request; -use BookStack\Uploads\Image; -use BookStack\Repos\PageRepo; class ImageController extends Controller { diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index df8549739..e010077bd 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -1,14 +1,14 @@ <?php namespace BookStack\Http\Controllers; use Activity; -use BookStack\Exceptions\NotFoundException; -use BookStack\Entities\EntityRepo; use BookStack\Auth\UserRepo; +use BookStack\Entities\EntityRepo; use BookStack\Entities\ExportService; +use BookStack\Exceptions\NotFoundException; +use GatherContent\Htmldiff\Htmldiff; use Illuminate\Http\Request; use Illuminate\Http\Response; use Views; -use GatherContent\Htmldiff\Htmldiff; class PageController extends Controller { diff --git a/app/Http/Controllers/PermissionController.php b/app/Http/Controllers/PermissionController.php index 215184b73..9be343c9a 100644 --- a/app/Http/Controllers/PermissionController.php +++ b/app/Http/Controllers/PermissionController.php @@ -1,7 +1,7 @@ <?php namespace BookStack\Http\Controllers; -use BookStack\Exceptions\PermissionsException; use BookStack\Auth\Permissions\PermissionsRepo; +use BookStack\Exceptions\PermissionsException; use Illuminate\Http\Request; class PermissionController extends Controller diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 6ae08a280..4402b7caf 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -1,8 +1,8 @@ <?php namespace BookStack\Http\Controllers; +use BookStack\Actions\ViewService; use BookStack\Entities\EntityRepo; use BookStack\Entities\SearchService; -use BookStack\Actions\ViewService; use Illuminate\Http\Request; class SearchController extends Controller diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 93e4c3450..5f5c8365e 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -1,11 +1,10 @@ <?php namespace BookStack\Http\Controllers; -use Exception; -use Illuminate\Http\Request; -use Illuminate\Http\Response; -use BookStack\Auth\UserRepo; use BookStack\Auth\Access\SocialAuthService; use BookStack\Auth\User; +use BookStack\Auth\UserRepo; +use Illuminate\Http\Request; +use Illuminate\Http\Response; class UserController extends Controller { diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index c3102571d..73c11a827 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -3,8 +3,8 @@ namespace BookStack\Http\Middleware; use Closure; -use Illuminate\Http\Request; use Fideloper\Proxy\TrustProxies as Middleware; +use Illuminate\Http\Request; class TrustProxies extends Middleware { diff --git a/app/Notifications/ConfirmEmail.php b/app/Notifications/ConfirmEmail.php index 858b12166..f3797e6e2 100644 --- a/app/Notifications/ConfirmEmail.php +++ b/app/Notifications/ConfirmEmail.php @@ -3,9 +3,9 @@ namespace BookStack\Notifications; use Illuminate\Bus\Queueable; -use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; +use Illuminate\Notifications\Notification; class ConfirmEmail extends Notification implements ShouldQueue { diff --git a/app/Notifications/ResetPassword.php b/app/Notifications/ResetPassword.php index affd8f076..86e93228f 100644 --- a/app/Notifications/ResetPassword.php +++ b/app/Notifications/ResetPassword.php @@ -2,8 +2,8 @@ namespace BookStack\Notifications; -use Illuminate\Notifications\Notification; use Illuminate\Notifications\Messages\MailMessage; +use Illuminate\Notifications\Notification; class ResetPassword extends Notification { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ef4c657d9..6fa0f9a52 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -5,8 +5,8 @@ use BookStack\Entities\Book; use BookStack\Entities\Bookshelf; use BookStack\Entities\Chapter; use BookStack\Entities\Page; -use BookStack\Settings\SettingService; use BookStack\Settings\Setting; +use BookStack\Settings\SettingService; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Support\ServiceProvider; use Schema; diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 11e3cc6d2..69925e945 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -3,7 +3,6 @@ namespace BookStack\Providers; use Illuminate\Support\ServiceProvider; -use Illuminate\Support\Facades\Broadcast; class BroadcastServiceProvider extends ServiceProvider { diff --git a/app/Providers/CustomFacadeProvider.php b/app/Providers/CustomFacadeProvider.php index 2a5b101db..98b242d21 100644 --- a/app/Providers/CustomFacadeProvider.php +++ b/app/Providers/CustomFacadeProvider.php @@ -3,17 +3,17 @@ namespace BookStack\Providers; use BookStack\Actions\Activity; +use BookStack\Actions\ActivityService; +use BookStack\Actions\View; +use BookStack\Actions\ViewService; +use BookStack\Auth\Permissions\PermissionService; +use BookStack\Settings\Setting; +use BookStack\Settings\SettingService; use BookStack\Uploads\Image; use BookStack\Uploads\ImageService; -use BookStack\Auth\Permissions\PermissionService; -use BookStack\Actions\ViewService; -use BookStack\Settings\Setting; -use BookStack\Actions\View; use Illuminate\Contracts\Cache\Repository; use Illuminate\Contracts\Filesystem\Factory; use Illuminate\Support\ServiceProvider; -use BookStack\Actions\ActivityService; -use BookStack\Settings\SettingService; use Intervention\Image\ImageManager; class CustomFacadeProvider extends ServiceProvider diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 00eeb036c..a826185d8 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -2,7 +2,6 @@ namespace BookStack\Providers; -use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use SocialiteProviders\Manager\SocialiteWasCalled; diff --git a/app/Providers/LdapUserProvider.php b/app/Providers/LdapUserProvider.php index 7f676eace..9c91def2f 100644 --- a/app/Providers/LdapUserProvider.php +++ b/app/Providers/LdapUserProvider.php @@ -2,9 +2,7 @@ namespace BookStack\Providers; -use BookStack\Auth\Role; use BookStack\Auth\Access\LdapService; -use BookStack\Auth\User; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\UserProvider; diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 88ab23526..c4c39d534 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,7 +2,6 @@ namespace BookStack\Providers; -use Illuminate\Routing\Router; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Route; diff --git a/app/Settings/SettingService.php b/app/Settings/SettingService.php index 756640485..c903bd60a 100644 --- a/app/Settings/SettingService.php +++ b/app/Settings/SettingService.php @@ -1,7 +1,5 @@ <?php namespace BookStack\Settings; -use BookStack\Settings\Setting; -use BookStack\Auth\User; use Illuminate\Contracts\Cache\Repository as Cache; /** diff --git a/app/Uploads/AttachmentService.php b/app/Uploads/AttachmentService.php index 26e341111..7bafb6c0a 100644 --- a/app/Uploads/AttachmentService.php +++ b/app/Uploads/AttachmentService.php @@ -1,8 +1,6 @@ <?php namespace BookStack\Uploads; use BookStack\Exceptions\FileUploadException; -use BookStack\Uploads\Attachment; -use BookStack\Uploads\UploadService; use Exception; use Symfony\Component\HttpFoundation\File\UploadedFile; diff --git a/app/Uploads/ImageRepo.php b/app/Uploads/ImageRepo.php index 194a0d583..df57b1345 100644 --- a/app/Uploads/ImageRepo.php +++ b/app/Uploads/ImageRepo.php @@ -1,9 +1,7 @@ <?php namespace BookStack\Uploads; -use BookStack\Uploads\Image; -use BookStack\Entities\Page; -use BookStack\Uploads\ImageService; use BookStack\Auth\Permissions\PermissionService; +use BookStack\Entities\Page; use Symfony\Component\HttpFoundation\File\UploadedFile; class ImageRepo diff --git a/app/Uploads/ImageService.php b/app/Uploads/ImageService.php index 9ecf9492e..f109db600 100644 --- a/app/Uploads/ImageService.php +++ b/app/Uploads/ImageService.php @@ -1,15 +1,13 @@ <?php namespace BookStack\Uploads; -use BookStack\Exceptions\ImageUploadException; -use BookStack\Uploads\Image; use BookStack\Auth\User; -use BookStack\Uploads\UploadService; +use BookStack\Exceptions\ImageUploadException; use DB; use Exception; +use Illuminate\Contracts\Cache\Repository as Cache; +use Illuminate\Contracts\Filesystem\Factory as FileSystem; use Intervention\Image\Exception\NotSupportedException; use Intervention\Image\ImageManager; -use Illuminate\Contracts\Filesystem\Factory as FileSystem; -use Illuminate\Contracts\Cache\Repository as Cache; use Symfony\Component\HttpFoundation\File\UploadedFile; class ImageService extends UploadService