@@ 127-145 (lines=19) @@ | ||
124 | * |
|
125 | * @param string $path |
|
126 | */ |
|
127 | protected function detectPathNotChanging(string $path) |
|
128 | { |
|
129 | $partsNotChanging = []; |
|
130 | $foundChangingElement = false; |
|
131 | ||
132 | foreach (Util\Path::getDirectoryListFromAbsolutePath($path) as $depth => $dir) { |
|
133 | // already found placeholder or found one right now |
|
134 | // path isn't static anymore so don't add directory to path not changing |
|
135 | if ($foundChangingElement || Util\Path::isContainingPlaceholder($dir)) { |
|
136 | $foundChangingElement = true; |
|
137 | continue; |
|
138 | } |
|
139 | // do not add the / element leading slash will be re-added later |
|
140 | if ($dir !== '/') { |
|
141 | $partsNotChanging[] = $dir; |
|
142 | } |
|
143 | } |
|
144 | $this->pathNotChanging = DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $partsNotChanging); |
|
145 | } |
|
146 | ||
147 | /** |
|
148 | * Get all created backups. |
@@ 189-209 (lines=21) @@ | ||
186 | * |
|
187 | * @param string $path |
|
188 | */ |
|
189 | private function detectPathNotChanging(string $path) |
|
190 | { |
|
191 | $partsNotChanging = []; |
|
192 | $foundChangingElement = false; |
|
193 | ||
194 | foreach (Util\Path::getDirectoryListFromAbsolutePath($path) as $depth => $dir) { |
|
195 | $this->pathElements[] = $dir; |
|
196 | ||
197 | // already found placeholder or found one right now |
|
198 | // path isn't static anymore so don't add directory to path not changing |
|
199 | if ($foundChangingElement || Util\Path::isContainingPlaceholder($dir)) { |
|
200 | $foundChangingElement = true; |
|
201 | continue; |
|
202 | } |
|
203 | // do not add the / element leading slash will be re-added later |
|
204 | if ($dir !== '/') { |
|
205 | $partsNotChanging[] = $dir; |
|
206 | } |
|
207 | } |
|
208 | $this->pathNotChanging = DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $partsNotChanging); |
|
209 | } |
|
210 | ||
211 | /** |
|
212 | * Filename setter. |