Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
11 | protected function path_for_file($fileOrUrl) |
||
12 | { |
||
13 | if (preg_match('{^//|http[s]?}', $fileOrUrl)) { |
||
14 | return $fileOrUrl; |
||
15 | } elseif (Director::fileExists($fileOrUrl)) { |
||
16 | $path = pathinfo($fileOrUrl); |
||
17 | $absoluteFile = Director::getAbsFile(preg_replace('/([^\?]*)?.*/', '$1', $fileOrUrl)); |
||
18 | $v = '.'.filemtime($absoluteFile).'.'; |
||
19 | |||
20 | $prefix = Director::baseURL(); |
||
21 | $fileOrUrl = $path['dirname'].'/'.str_replace('.', $v, $path['basename']); |
||
22 | return "{$prefix}{$fileOrUrl}"; |
||
23 | } else { |
||
24 | return false; |
||
25 | } |
||
26 | } |
||
27 | } |
||
28 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.