App.php
1 month ago
Artisan.php
1 month ago
Auth.php
1 month ago
Blade.php
1 month ago
Broadcast.php
1 month ago
Bus.php
1 month ago
Cache.php
1 month ago
Config.php
1 month ago
Cookie.php
1 month ago
Crypt.php
1 month ago
DB.php
1 month ago
Date.php
1 month ago
Event.php
1 month ago
Facade.php
1 month ago
File.php
1 month ago
Gate.php
1 month ago
Hash.php
1 month ago
Http.php
1 month ago
Lang.php
1 month ago
Log.php
1 month ago
Mail.php
1 month ago
Notification.php
1 month ago
ParallelTesting.php
1 month ago
Password.php
1 month ago
Queue.php
1 month ago
RateLimiter.php
1 month ago
Redirect.php
1 month ago
Redis.php
1 month ago
Request.php
1 month ago
Response.php
1 month ago
Route.php
1 month ago
Schema.php
1 month ago
Session.php
1 month ago
Storage.php
1 month ago
URL.php
1 month ago
Validator.php
1 month ago
View.php
1 month ago
Vite.php
1 month ago
Storage.php
129 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\Illuminate\Support\Facades; |
| 4 | |
| 5 | use IAWPSCOPED\Illuminate\Filesystem\Filesystem; |
| 6 | /** |
| 7 | * @method static \Illuminate\Contracts\Filesystem\Filesystem drive(string|null $name = null) |
| 8 | * @method static \Illuminate\Contracts\Filesystem\Filesystem disk(string|null $name = null) |
| 9 | * @method static \Illuminate\Contracts\Filesystem\Filesystem cloud() |
| 10 | * @method static \Illuminate\Contracts\Filesystem\Filesystem build(string|array $config) |
| 11 | * @method static \Illuminate\Contracts\Filesystem\Filesystem createLocalDriver(array $config) |
| 12 | * @method static \Illuminate\Contracts\Filesystem\Filesystem createFtpDriver(array $config) |
| 13 | * @method static \Illuminate\Contracts\Filesystem\Filesystem createSftpDriver(array $config) |
| 14 | * @method static \Illuminate\Contracts\Filesystem\Cloud createS3Driver(array $config) |
| 15 | * @method static \Illuminate\Contracts\Filesystem\Filesystem createScopedDriver(array $config) |
| 16 | * @method static \Illuminate\Filesystem\FilesystemManager set(string $name, mixed $disk) |
| 17 | * @method static string getDefaultDriver() |
| 18 | * @method static string getDefaultCloudDriver() |
| 19 | * @method static \Illuminate\Filesystem\FilesystemManager forgetDisk(array|string $disk) |
| 20 | * @method static void purge(string|null $name = null) |
| 21 | * @method static \Illuminate\Filesystem\FilesystemManager extend(string $driver, \Closure $callback) |
| 22 | * @method static \Illuminate\Filesystem\FilesystemManager setApplication(\Illuminate\Contracts\Foundation\Application $app) |
| 23 | * @method static bool exists(string $path) |
| 24 | * @method static string|null get(string $path) |
| 25 | * @method static resource|null readStream(string $path) |
| 26 | * @method static bool put(string $path, string|resource $contents, mixed $options = []) |
| 27 | * @method static bool writeStream(string $path, resource $resource, array $options = []) |
| 28 | * @method static string getVisibility(string $path) |
| 29 | * @method static bool setVisibility(string $path, string $visibility) |
| 30 | * @method static bool prepend(string $path, string $data) |
| 31 | * @method static bool append(string $path, string $data) |
| 32 | * @method static bool delete(string|array $paths) |
| 33 | * @method static bool copy(string $from, string $to) |
| 34 | * @method static bool move(string $from, string $to) |
| 35 | * @method static int size(string $path) |
| 36 | * @method static int lastModified(string $path) |
| 37 | * @method static array files(string|null $directory = null, bool $recursive = false) |
| 38 | * @method static array allFiles(string|null $directory = null) |
| 39 | * @method static array directories(string|null $directory = null, bool $recursive = false) |
| 40 | * @method static array allDirectories(string|null $directory = null) |
| 41 | * @method static bool makeDirectory(string $path) |
| 42 | * @method static bool deleteDirectory(string $directory) |
| 43 | * @method static \Illuminate\Filesystem\FilesystemAdapter assertExists(string|array $path, string|null $content = null) |
| 44 | * @method static \Illuminate\Filesystem\FilesystemAdapter assertMissing(string|array $path) |
| 45 | * @method static \Illuminate\Filesystem\FilesystemAdapter assertDirectoryEmpty(string $path) |
| 46 | * @method static bool missing(string $path) |
| 47 | * @method static bool fileExists(string $path) |
| 48 | * @method static bool fileMissing(string $path) |
| 49 | * @method static bool directoryExists(string $path) |
| 50 | * @method static bool directoryMissing(string $path) |
| 51 | * @method static string path(string $path) |
| 52 | * @method static \Symfony\Component\HttpFoundation\StreamedResponse response(string $path, string|null $name = null, array $headers = [], string|null $disposition = 'inline') |
| 53 | * @method static \Symfony\Component\HttpFoundation\StreamedResponse download(string $path, string|null $name = null, array $headers = []) |
| 54 | * @method static string|false putFile(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, mixed $options = []) |
| 55 | * @method static string|false putFileAs(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, string $name, mixed $options = []) |
| 56 | * @method static string|false checksum(string $path, array $options = []) |
| 57 | * @method static string|false mimeType(string $path) |
| 58 | * @method static string url(string $path) |
| 59 | * @method static bool providesTemporaryUrls() |
| 60 | * @method static string temporaryUrl(string $path, \DateTimeInterface $expiration, array $options = []) |
| 61 | * @method static array temporaryUploadUrl(string $path, \DateTimeInterface $expiration, array $options = []) |
| 62 | * @method static \League\Flysystem\FilesystemOperator getDriver() |
| 63 | * @method static \League\Flysystem\FilesystemAdapter getAdapter() |
| 64 | * @method static array getConfig() |
| 65 | * @method static void buildTemporaryUrlsUsing(\Closure $callback) |
| 66 | * @method static \Illuminate\Filesystem\FilesystemAdapter|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null) |
| 67 | * @method static \Illuminate\Filesystem\FilesystemAdapter|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null) |
| 68 | * @method static void macro(string $name, object|callable $macro) |
| 69 | * @method static void mixin(object $mixin, bool $replace = true) |
| 70 | * @method static bool hasMacro(string $name) |
| 71 | * @method static void flushMacros() |
| 72 | * @method static mixed macroCall(string $method, array $parameters) |
| 73 | * @method static bool has(string $location) |
| 74 | * @method static string read(string $location) |
| 75 | * @method static \League\Flysystem\DirectoryListing listContents(string $location, bool $deep = false) |
| 76 | * @method static int fileSize(string $path) |
| 77 | * @method static string visibility(string $path) |
| 78 | * @method static void write(string $location, string $contents, array $config = []) |
| 79 | * @method static void createDirectory(string $location, array $config = []) |
| 80 | * |
| 81 | * @see \Illuminate\Filesystem\FilesystemManager |
| 82 | * @internal |
| 83 | */ |
| 84 | class Storage extends Facade |
| 85 | { |
| 86 | /** |
| 87 | * Replace the given disk with a local testing disk. |
| 88 | * |
| 89 | * @param string|null $disk |
| 90 | * @param array $config |
| 91 | * @return \Illuminate\Contracts\Filesystem\Filesystem |
| 92 | */ |
| 93 | public static function fake($disk = null, array $config = []) |
| 94 | { |
| 95 | $disk = $disk ?: static::$app['config']->get('filesystems.default'); |
| 96 | $root = storage_path('framework/testing/disks/' . $disk); |
| 97 | if ($token = ParallelTesting::token()) { |
| 98 | $root = "{$root}_test_{$token}"; |
| 99 | } |
| 100 | (new Filesystem())->cleanDirectory($root); |
| 101 | static::set($disk, $fake = static::createLocalDriver(\array_merge($config, ['root' => $root]))); |
| 102 | return \IAWPSCOPED\tap($fake)->buildTemporaryUrlsUsing(function ($path, $expiration) { |
| 103 | return URL::to($path . '?expiration=' . $expiration->getTimestamp()); |
| 104 | }); |
| 105 | } |
| 106 | /** |
| 107 | * Replace the given disk with a persistent local testing disk. |
| 108 | * |
| 109 | * @param string|null $disk |
| 110 | * @param array $config |
| 111 | * @return \Illuminate\Contracts\Filesystem\Filesystem |
| 112 | */ |
| 113 | public static function persistentFake($disk = null, array $config = []) |
| 114 | { |
| 115 | $disk = $disk ?: static::$app['config']->get('filesystems.default'); |
| 116 | static::set($disk, $fake = static::createLocalDriver(\array_merge($config, ['root' => storage_path('framework/testing/disks/' . $disk)]))); |
| 117 | return $fake; |
| 118 | } |
| 119 | /** |
| 120 | * Get the registered name of the component. |
| 121 | * |
| 122 | * @return string |
| 123 | */ |
| 124 | protected static function getFacadeAccessor() |
| 125 | { |
| 126 | return 'filesystem'; |
| 127 | } |
| 128 | } |
| 129 |