1 | <?php |
||
9 | class FileSelection |
||
10 | { |
||
11 | /** @var array */ |
||
12 | protected $includeFilesAndDirectories = []; |
||
13 | |||
14 | /** @var array */ |
||
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) |
||
41 | |||
42 | /** |
||
43 | * Do not included the given files and directories. |
||
44 | * |
||
45 | * @param array|string $excludeFilesAndDirectories |
||
46 | * |
||
47 | * @return \Spatie\Backup\Tasks\Backup\FileSelection |
||
48 | */ |
||
49 | public function excludeFilesFrom($excludeFilesAndDirectories) |
||
59 | |||
60 | /** |
||
61 | * Enable or disable the following of symlinks. |
||
62 | * |
||
63 | * @param bool $shouldFollowLinks |
||
64 | * |
||
65 | * @return \Spatie\Backup\Tasks\Backup\FileSelection |
||
66 | */ |
||
67 | public function shouldFollowLinks($shouldFollowLinks) |
||
68 | { |
||
69 | $this->shouldFollowLinks = $shouldFollowLinks; |
||
70 | |||
71 | return $this; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @return array |
||
76 | */ |
||
77 | public function getSelectedFiles() |
||
101 | |||
102 | /** |
||
103 | * Make a unique array of all files from a given array of files and directories. |
||
104 | * |
||
105 | * @param array $paths |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | protected function getAllFilesFromPaths(array $paths) |
||
132 | |||
133 | /** |
||
134 | * Recursively get all the files within a given directory. |
||
135 | * |
||
136 | * @param string $directory |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | protected function getAllFilesFromDirectory($directory) |
||
160 | |||
161 | /** |
||
162 | * Check all paths in array for a wildcard (*) and build a new array from the results. |
||
163 | * |
||
164 | * @param array $paths |
||
165 | * |
||
166 | * @return array |
||
167 | */ |
||
168 | protected function expandWildCardPaths(array $paths) |
||
177 | } |
||
178 |