1 | <?php |
||
9 | class FileSelection |
||
10 | { |
||
11 | /** @var \Illuminate\Support\Collection */ |
||
12 | protected $includeFilesAndDirectories; |
||
13 | |||
14 | /** @var \Illuminate\Support\Collection */ |
||
15 | protected $excludeFilesAndDirectories; |
||
16 | |||
17 | /** @var bool */ |
||
18 | protected $shouldFollowLinks = false; |
||
19 | |||
20 | /** |
||
21 | * @param array|string $includeFilesAndDirectories |
||
22 | * |
||
23 | * @return \Spatie\Backup\Tasks\Backup\FileSelection |
||
24 | */ |
||
25 | public static function create($includeFilesAndDirectories = []) |
||
29 | |||
30 | /** |
||
31 | * @param array|string $includeFilesAndDirectories |
||
32 | */ |
||
33 | public function __construct($includeFilesAndDirectories) |
||
39 | |||
40 | /** |
||
41 | * Do not included the given files and directories. |
||
42 | * |
||
43 | * @param array|string $excludeFilesAndDirectories |
||
44 | * |
||
45 | * @return \Spatie\Backup\Tasks\Backup\FileSelection |
||
46 | */ |
||
47 | public function excludeFilesFrom($excludeFilesAndDirectories) |
||
53 | |||
54 | /** |
||
55 | * Enable or disable the following of symlinks. |
||
56 | * |
||
57 | * @param bool $shouldFollowLinks |
||
58 | * |
||
59 | * @return \Spatie\Backup\Tasks\Backup\FileSelection |
||
60 | */ |
||
61 | public function shouldFollowLinks($shouldFollowLinks) |
||
67 | |||
68 | /** |
||
69 | * @return \Illuminate\Support\Collection |
||
70 | */ |
||
71 | public function getSelectedFiles() |
||
95 | |||
96 | /** |
||
97 | * Make a unique array of all files from a given array of files and directories. |
||
98 | * |
||
99 | * @param \Illuminate\Support\Collection $paths |
||
100 | * |
||
101 | * @return \Illuminate\Support\Collection |
||
102 | */ |
||
103 | protected function getAllFilesFromPaths(Collection $paths) |
||
121 | |||
122 | /** |
||
123 | * Recursively get all the files within a given directory. |
||
124 | * |
||
125 | * @param string $directory |
||
126 | * |
||
127 | * @return \Illuminate\Support\Collection |
||
128 | */ |
||
129 | protected function getAllFilesFromDirectory($directory) |
||
147 | |||
148 | /** |
||
149 | * Fully expand paths, and reject non-existing paths. |
||
150 | * |
||
151 | * @param $paths |
||
152 | * |
||
153 | * @return \Illuminate\Support\Collection |
||
154 | */ |
||
155 | protected function createPathCollection($paths) |
||
168 | } |
||
169 |