Conditions | 4 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | 5 | public function applyVersion($relPath): string |
|
36 | { |
||
37 | 5 | $version = $this->getVersion($relPath); |
|
38 | 5 | $path = $version ? sprintf('%s?v=%s', $relPath, $version) : $relPath; |
|
39 | |||
40 | 5 | if ($this->cdnHost) { |
|
|
|||
41 | 1 | if (mb_substr($path, 0, 1, "UTF-8") !== '/') { |
|
42 | 1 | $path = '/' . $path; |
|
43 | } |
||
44 | |||
45 | 1 | $path = '//' . $this->cdnHost . $path; |
|
46 | } |
||
47 | |||
48 | 5 | return $path; |
|
49 | } |
||
50 | } |
||
51 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: