1 | <?php declare(strict_types=1); |
||
28 | class FilesystemLocation implements Location |
||
29 | { |
||
30 | |||
31 | /** |
||
32 | * Path that this location points to. |
||
33 | * |
||
34 | * @since 0.1.0 |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $path; |
||
39 | |||
40 | /** |
||
41 | * Extensions that this location can accept. |
||
42 | * |
||
43 | * @since 0.1.0 |
||
44 | * |
||
45 | * @var Extensions |
||
46 | */ |
||
47 | protected $extensions; |
||
48 | |||
49 | /** |
||
50 | * Instantiate a FilesystemLocation object. |
||
51 | * |
||
52 | * @since 0.1.0 |
||
53 | * |
||
54 | * @param string $path Path that this location points to. |
||
55 | * @param Extensions|array|string|null $extensions Optional. Extensions that this location can accept. |
||
56 | */ |
||
57 | 45 | public function __construct(string $path, $extensions = null) |
|
62 | |||
63 | /** |
||
64 | * Get the first URI that matches the given criteria. |
||
65 | * |
||
66 | * @since 0.1.0 |
||
67 | * |
||
68 | * @param array $criteria Criteria to match. |
||
69 | * |
||
70 | * @return string|false URI that matches the criteria or false if none found. |
||
71 | */ |
||
72 | 44 | public function getURI(array $criteria) |
|
80 | |||
81 | /** |
||
82 | * Get all URIs that match the given criteria. |
||
83 | * |
||
84 | * @since 0.1.1 |
||
85 | * |
||
86 | * @param array $criteria Criteria to match. |
||
87 | * |
||
88 | * @return URIs URIs that match the criteria or an empty collection if none found. |
||
89 | */ |
||
90 | 44 | public function getURIs(array $criteria): URIs |
|
113 | |||
114 | /** |
||
115 | * Get the name pattern to pass to the file finder. |
||
116 | * |
||
117 | * @since 0.1.3 |
||
118 | * |
||
119 | * @param array $criteria Criteria to match. |
||
120 | * @param string $extension Extension to match. |
||
121 | * |
||
122 | * @return string Name pattern to pass to the file finder. |
||
123 | 44 | */ |
|
124 | protected function getNamePattern(array $criteria, string $extension): string |
||
152 | |||
153 | /** |
||
154 | * Get the path pattern to pass to the file finder. |
||
155 | * |
||
156 | * @since 0.4.7 |
||
157 | * |
||
158 | * @param string $relativePath Relative path that was included in the |
||
159 | * criterion. |
||
160 | * @return string Path pattern to pass to the file finder. |
||
161 | 44 | */ |
|
162 | 44 | protected function getPathPattern(string $relativePath): string |
|
170 | |||
171 | /** |
||
172 | * Get the relative path that is included in the criterion. |
||
173 | * |
||
174 | * @since 0.4.7 |
||
175 | * |
||
176 | * @param array $criteria Criteria to extract the relative path from. |
||
177 | 45 | * @return string Relative path included in the criterion. |
|
178 | */ |
||
179 | 45 | protected function getRelativePath($criteria): string |
|
190 | |||
191 | /** |
||
192 | * Validate the extensions and return a collection. |
||
193 | * |
||
194 | * @since 0.1.1 |
||
195 | * |
||
196 | * @param Extensions|array|string|null $extensions Extensions to validate. |
||
197 | * |
||
198 | * @return Extensions Validated extensions collection. |
||
199 | */ |
||
200 | protected function validateExtensions($extensions): Extensions |
||
212 | } |
||
213 |
It seems like you are assigning to a variable which was imported through a
use
statement which was not imported by reference.For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.
Change not visible in outer-scope
Change visible in outer-scope