1 | <?php |
||
8 | class FileSelection |
||
9 | { |
||
10 | /** @var \Illuminate\Support\Collection */ |
||
11 | protected $includeFilesAndDirectories; |
||
12 | |||
13 | /** @var \Illuminate\Support\Collection */ |
||
14 | protected $excludeFilesAndDirectories; |
||
15 | |||
16 | /** @var bool */ |
||
17 | protected $shouldFollowLinks = false; |
||
18 | |||
19 | /** |
||
20 | * @param array|string $includeFilesAndDirectories |
||
21 | * |
||
22 | * @return \Spatie\Backup\Tasks\Backup\FileSelection |
||
23 | */ |
||
24 | public static function create($includeFilesAndDirectories = []): FileSelection |
||
25 | { |
||
26 | return new static($includeFilesAndDirectories); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param array|string $includeFilesAndDirectories |
||
31 | */ |
||
32 | public function __construct($includeFilesAndDirectories = []) |
||
33 | { |
||
34 | $this->includeFilesAndDirectories = collect($includeFilesAndDirectories); |
||
35 | |||
36 | $this->excludeFilesAndDirectories = collect(); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Do not included the given files and directories. |
||
41 | * |
||
42 | * @param array|string $excludeFilesAndDirectories |
||
43 | * |
||
44 | * @return \Spatie\Backup\Tasks\Backup\FileSelection |
||
45 | */ |
||
46 | public function excludeFilesFrom($excludeFilesAndDirectories): FileSelection |
||
52 | |||
53 | /** |
||
54 | * Enable or disable the following of symlinks. |
||
55 | * |
||
56 | * @param bool $shouldFollowLinks |
||
57 | * |
||
58 | * @return \Spatie\Backup\Tasks\Backup\FileSelection |
||
59 | */ |
||
60 | public function shouldFollowLinks(bool $shouldFollowLinks): FileSelection |
||
66 | |||
67 | /** |
||
68 | * @return \Generator|string[] |
||
69 | */ |
||
70 | public function selectedFiles() |
||
103 | |||
104 | protected function includedFiles(): array |
||
110 | |||
111 | protected function includedDirectories(): array |
||
117 | |||
118 | protected function shouldExclude(string $path): bool |
||
128 | |||
129 | /** |
||
130 | * @param string|array $paths |
||
131 | * |
||
132 | * @return \Illuminate\Support\Collection |
||
133 | */ |
||
134 | protected function sanitize($paths): Collection |
||
150 | } |
||
151 |