Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Details | Vergleich mit vorheriger | 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 = [])
621 lars 62
 * @method static array temporaryUploadUrl(string $path, \DateTimeInterface $expiration, array $options = [])
148 lars 63
 * @method static \League\Flysystem\FilesystemOperator getDriver()
64
 * @method static \League\Flysystem\FilesystemAdapter getAdapter()
65
 * @method static array getConfig()
66
 * @method static void buildTemporaryUrlsUsing(\Closure $callback)
67
 * @method static \Illuminate\Filesystem\FilesystemAdapter|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
68
 * @method static \Illuminate\Filesystem\FilesystemAdapter|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
69
 * @method static void macro(string $name, object|callable $macro)
70
 * @method static void mixin(object $mixin, bool $replace = true)
71
 * @method static bool hasMacro(string $name)
72
 * @method static void flushMacros()
73
 * @method static mixed macroCall(string $method, array $parameters)
74
 * @method static bool has(string $location)
75
 * @method static string read(string $location)
76
 * @method static \League\Flysystem\DirectoryListing listContents(string $location, bool $deep = false)
77
 * @method static int fileSize(string $path)
78
 * @method static string visibility(string $path)
79
 * @method static void write(string $location, string $contents, array $config = [])
80
 * @method static void createDirectory(string $location, array $config = [])
81
 *
82
 * @see \Illuminate\Filesystem\FilesystemManager
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
 
97
        $root = storage_path('framework/testing/disks/'.$disk);
98
 
99
        if ($token = ParallelTesting::token()) {
100
            $root = "{$root}_test_{$token}";
101
        }
102
 
103
        (new Filesystem)->cleanDirectory($root);
104
 
105
        static::set($disk, $fake = static::createLocalDriver(array_merge($config, [
106
            'root' => $root,
107
        ])));
108
 
109
        return tap($fake)->buildTemporaryUrlsUsing(function ($path, $expiration) {
110
            return URL::to($path.'?expiration='.$expiration->getTimestamp());
111
        });
112
    }
113
 
114
    /**
115
     * Replace the given disk with a persistent local testing disk.
116
     *
117
     * @param  string|null  $disk
118
     * @param  array  $config
119
     * @return \Illuminate\Contracts\Filesystem\Filesystem
120
     */
121
    public static function persistentFake($disk = null, array $config = [])
122
    {
123
        $disk = $disk ?: static::$app['config']->get('filesystems.default');
124
 
125
        static::set($disk, $fake = static::createLocalDriver(array_merge($config, [
126
            'root' => storage_path('framework/testing/disks/'.$disk),
127
        ])));
128
 
129
        return $fake;
130
    }
131
 
132
    /**
133
     * Get the registered name of the component.
134
     *
135
     * @return string
136
     */
137
    protected static function getFacadeAccessor()
138
    {
139
        return 'filesystem';
140
    }
141
}