Subversion-Projekte lars-tiefland.laravel_shop

Revision

Zur aktuellen Revision | Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Support\Facades;
4
 
5
use Illuminate\Filesystem\Filesystem;
6
 
7
/**
8
 * @method static \Illuminate\Contracts\Filesystem\Filesystem drive(string|null $name = null)
9
 * @method static \Illuminate\Contracts\Filesystem\Filesystem disk(string|null $name = null)
10
 * @method static \Illuminate\Contracts\Filesystem\Filesystem cloud()
11
 * @method static \Illuminate\Contracts\Filesystem\Filesystem build(string|array $config)
12
 * @method static \Illuminate\Contracts\Filesystem\Filesystem createLocalDriver(array $config)
13
 * @method static \Illuminate\Contracts\Filesystem\Filesystem createFtpDriver(array $config)
14
 * @method static \Illuminate\Contracts\Filesystem\Filesystem createSftpDriver(array $config)
15
 * @method static \Illuminate\Contracts\Filesystem\Cloud createS3Driver(array $config)
16
 * @method static \Illuminate\Contracts\Filesystem\Filesystem createScopedDriver(array $config)
17
 * @method static \Illuminate\Filesystem\FilesystemManager set(string $name, mixed $disk)
18
 * @method static string getDefaultDriver()
19
 * @method static string getDefaultCloudDriver()
20
 * @method static \Illuminate\Filesystem\FilesystemManager forgetDisk(array|string $disk)
21
 * @method static void purge(string|null $name = null)
22
 * @method static \Illuminate\Filesystem\FilesystemManager extend(string $driver, \Closure $callback)
23
 * @method static \Illuminate\Filesystem\FilesystemManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
24
 * @method static bool exists(string $path)
25
 * @method static string|null get(string $path)
26
 * @method static resource|null readStream(string $path)
27
 * @method static bool put(string $path, string|resource $contents, mixed $options = [])
28
 * @method static bool writeStream(string $path, resource $resource, array $options = [])
29
 * @method static string getVisibility(string $path)
30
 * @method static bool setVisibility(string $path, string $visibility)
31
 * @method static bool prepend(string $path, string $data)
32
 * @method static bool append(string $path, string $data)
33
 * @method static bool delete(string|array $paths)
34
 * @method static bool copy(string $from, string $to)
35
 * @method static bool move(string $from, string $to)
36
 * @method static int size(string $path)
37
 * @method static int lastModified(string $path)
38
 * @method static array files(string|null $directory = null, bool $recursive = false)
39
 * @method static array allFiles(string|null $directory = null)
40
 * @method static array directories(string|null $directory = null, bool $recursive = false)
41
 * @method static array allDirectories(string|null $directory = null)
42
 * @method static bool makeDirectory(string $path)
43
 * @method static bool deleteDirectory(string $directory)
44
 * @method static \Illuminate\Filesystem\FilesystemAdapter assertExists(string|array $path, string|null $content = null)
45
 * @method static \Illuminate\Filesystem\FilesystemAdapter assertMissing(string|array $path)
46
 * @method static \Illuminate\Filesystem\FilesystemAdapter assertDirectoryEmpty(string $path)
47
 * @method static bool missing(string $path)
48
 * @method static bool fileExists(string $path)
49
 * @method static bool fileMissing(string $path)
50
 * @method static bool directoryExists(string $path)
51
 * @method static bool directoryMissing(string $path)
52
 * @method static string path(string $path)
53
 * @method static \Symfony\Component\HttpFoundation\StreamedResponse response(string $path, string|null $name = null, array $headers = [], string|null $disposition = 'inline')
54
 * @method static \Symfony\Component\HttpFoundation\StreamedResponse download(string $path, string|null $name = null, array $headers = [])
55
 * @method static string|false putFile(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, mixed $options = [])
56
 * @method static string|false putFileAs(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, string $name, mixed $options = [])
57
 * @method static string|false checksum(string $path, array $options = [])
58
 * @method static string|false mimeType(string $path)
59
 * @method static string url(string $path)
60
 * @method static bool providesTemporaryUrls()
61
 * @method static string temporaryUrl(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
 */
83
class Storage extends Facade
84
{
85
    /**
86
     * Replace the given disk with a local testing disk.
87
     *
88
     * @param  string|null  $disk
89
     * @param  array  $config
90
     * @return \Illuminate\Contracts\Filesystem\Filesystem
91
     */
92
    public static function fake($disk = null, array $config = [])
93
    {
94
        $disk = $disk ?: static::$app['config']->get('filesystems.default');
95
 
96
        $root = storage_path('framework/testing/disks/'.$disk);
97
 
98
        if ($token = ParallelTesting::token()) {
99
            $root = "{$root}_test_{$token}";
100
        }
101
 
102
        (new Filesystem)->cleanDirectory($root);
103
 
104
        static::set($disk, $fake = static::createLocalDriver(array_merge($config, [
105
            'root' => $root,
106
        ])));
107
 
108
        return tap($fake)->buildTemporaryUrlsUsing(function ($path, $expiration) {
109
            return URL::to($path.'?expiration='.$expiration->getTimestamp());
110
        });
111
    }
112
 
113
    /**
114
     * Replace the given disk with a persistent local testing disk.
115
     *
116
     * @param  string|null  $disk
117
     * @param  array  $config
118
     * @return \Illuminate\Contracts\Filesystem\Filesystem
119
     */
120
    public static function persistentFake($disk = null, array $config = [])
121
    {
122
        $disk = $disk ?: static::$app['config']->get('filesystems.default');
123
 
124
        static::set($disk, $fake = static::createLocalDriver(array_merge($config, [
125
            'root' => storage_path('framework/testing/disks/'.$disk),
126
        ])));
127
 
128
        return $fake;
129
    }
130
 
131
    /**
132
     * Get the registered name of the component.
133
     *
134
     * @return string
135
     */
136
    protected static function getFacadeAccessor()
137
    {
138
        return 'filesystem';
139
    }
140
}