@@ 68-84 (lines=17) @@ | ||
65 | * @param string $path |
|
66 | * @param int|null $time |
|
67 | */ |
|
68 | public function __construct(string $path, $time = null) |
|
69 | { |
|
70 | // remove trailing slashes |
|
71 | $path = rtrim($path, DIRECTORY_SEPARATOR); |
|
72 | $this->pathRaw = $path; |
|
73 | $this->pathNotChanging = $path; |
|
74 | $this->time = $time; |
|
75 | ||
76 | if (Util\Path::isContainingPlaceholder($path)) { |
|
77 | $this->pathIsChanging = true; |
|
78 | $this->detectPathNotChanging($path); |
|
79 | // replace potential date placeholder |
|
80 | $path = Util\Path::replaceDatePlaceholders($path, $this->time); |
|
81 | } |
|
82 | ||
83 | $this->path = $path; |
|
84 | } |
|
85 | ||
86 | /** |
|
87 | * Find path elements that can't change because of placeholder usage. |
@@ 146-161 (lines=16) @@ | ||
143 | * @param string $path |
|
144 | * @param int $time |
|
145 | */ |
|
146 | public function setPath($path, $time = null) |
|
147 | { |
|
148 | // remove trailing slashes |
|
149 | $path = rtrim($path, DIRECTORY_SEPARATOR); |
|
150 | $this->pathRaw = $path; |
|
151 | $this->pathNotChanging = $path; |
|
152 | ||
153 | if (Util\Path::isContainingPlaceholder($path)) { |
|
154 | $this->pathIsChanging = true; |
|
155 | $this->detectPathNotChanging($path); |
|
156 | // replace potential date placeholder |
|
157 | $path = Util\Path::replaceDatePlaceholders($path, $time); |
|
158 | } |
|
159 | ||
160 | $this->path = $path; |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * Return path element at given index. |