1 | <?php |
||
17 | trait Path |
||
18 | { |
||
19 | /** |
||
20 | * Absolute path to the directory where to store the backup. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $path; |
||
25 | |||
26 | /** |
||
27 | * Path to the backup with potential date placeholders like %d. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $pathRaw; |
||
32 | |||
33 | /** |
||
34 | * Indicates if the path changes over time. |
||
35 | * |
||
36 | * @var bool |
||
37 | */ |
||
38 | protected $pathIsChanging = false; |
||
39 | |||
40 | /** |
||
41 | * Part of the path without placeholders |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $pathNotChanging; |
||
46 | |||
47 | /** |
||
48 | * List of all path elements. |
||
49 | * |
||
50 | * @var string[] |
||
51 | */ |
||
52 | protected $pathElements = []; |
||
53 | |||
54 | /** |
||
55 | * Directory setter. |
||
56 | * |
||
57 | * @param string $path |
||
58 | * @param int $time |
||
59 | */ |
||
60 | 46 | public function setPath($path, $time = null) |
|
76 | |||
77 | /** |
||
78 | * Return path element at given index. |
||
79 | * |
||
80 | * @param int $index |
||
81 | * @return string |
||
82 | */ |
||
83 | 6 | public function getPathElementAtIndex(int $index) : string |
|
87 | |||
88 | /** |
||
89 | * Return the full target path depth. |
||
90 | * |
||
91 | * @return int |
||
92 | */ |
||
93 | 10 | public function getPathDepth() : int |
|
97 | |||
98 | /** |
||
99 | * Find path elements that can't change because of placeholder usage. |
||
100 | * |
||
101 | * @param string $path |
||
102 | */ |
||
103 | 11 | protected function detectPathNotChanging(string $path) |
|
124 | } |
||
125 |