-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathStorageServiceInterface.php
102 lines (91 loc) · 2.77 KB
/
StorageServiceInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php declare(strict_types=1);
/**
* Copyright (c) Florian Krämer (https://florian-kraemer.net)
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Florian Krämer (https://florian-kraemer.net)
* @author Florian Krämer
* @link https://github.com/Phauthentic
* @license https://opensource.org/licenses/MIT MIT License
*/
namespace PhpCollective\Infrastructure\Storage;
use League\Flysystem\Config;
use League\Flysystem\FilesystemAdapter;
/**
* StorageServiceInterface
*/
interface StorageServiceInterface
{
/**
* Adapter Factory
*
* @return \PhpCollective\Infrastructure\Storage\StorageAdapterFactoryInterface
*/
public function adapterFactory(): StorageAdapterFactoryInterface;
/**
* Get the adapter collection
*
* @return \PhpCollective\Infrastructure\Storage\AdapterCollectionInterface
*/
public function adapters(): AdapterCollectionInterface;
/**
* Gets an adapter instance, lazy loads it as needed.
*
* @param string $name
*
* @return \League\Flysystem\FilesystemAdapter
*/
public function adapter(string $name): FilesystemAdapter;
/**
* Adds an adapter config
*
* @param string $name
* @param string $class
* @param array $options
*
* @return void
*/
public function addAdapterConfig(string $name, string $class, array $options);
/**
* Stores a resource in a storage backend
*
* @param string $adapter Adapter config name
* @param string $path Path where the file is stored
* @param resource $resource Resource to store
* @param \League\Flysystem\Config|null $config
*
* @return void
*/
public function storeResource(string $adapter, string $path, $resource, ?Config $config = null): void;
/**
* Stores a file in a storage backend
*
* @param string $adapter Adapter config name
* @param string $path Path where the file is stored
* @param string $file File to store
* @param \League\Flysystem\Config|null $config
*
* @return void
*/
public function storeFile(string $adapter, string $path, string $file, ?Config $config = null): void;
/**
* Checks if a file exists in a store
*
* @param string $adapter Adapter
* @param string $path Path
*
* @return bool
*/
public function fileExists(string $adapter, string $path): bool;
/**
* Removes a file from a storage backend
*
* @param string $adapter Name
* @param string $path File to delete
*
* @return void
*/
public function removeFile(string $adapter, string $path): void;
}