]> BookStack Code Mirror - bookstack/blob - app/Uploads/UploadService.php
Added locale and text direction to html templates
[bookstack] / app / Uploads / UploadService.php
1 <?php namespace BookStack\Uploads;
2
3 use Illuminate\Contracts\Filesystem\Factory as FileSystem;
4 use Illuminate\Contracts\Filesystem\Filesystem as FileSystemInstance;
5
6 abstract class UploadService
7 {
8
9     /**
10      * @var FileSystem
11      */
12     protected $fileSystem;
13
14
15     /**
16      * FileService constructor.
17      * @param $fileSystem
18      */
19     public function __construct(FileSystem $fileSystem)
20     {
21         $this->fileSystem = $fileSystem;
22     }
23
24     /**
25      * Get the storage that will be used for storing images.
26      * @return FileSystemInstance
27      */
28     protected function getStorage()
29     {
30         $storageType = config('filesystems.default');
31         return $this->fileSystem->disk($storageType);
32     }
33
34     /**
35      * Check whether or not a folder is empty.
36      * @param $path
37      * @return bool
38      */
39     protected function isFolderEmpty($path)
40     {
41         $files = $this->getStorage()->files($path);
42         $folders = $this->getStorage()->directories($path);
43         return (count($files) === 0 && count($folders) === 0);
44     }
45 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.