| Conditions | 4 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 3 | public function isValid($domain) : bool |
|
| 20 | { |
||
| 21 | 3 | $hostname = parse_url($domain, PHP_URL_HOST); |
|
| 22 | |||
| 23 | 3 | if (!$hostname) { |
|
|
|
|||
| 24 | 2 | $hostname = $domain; |
|
| 25 | } |
||
| 26 | |||
| 27 | 3 | foreach ($this->getNameVariations($hostname) as $nameVariation) { |
|
| 28 | 3 | if (in_array($nameVariation, $this->getAllowedNames(), true)) { |
|
| 29 | 3 | return true; |
|
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | 3 | return false; |
|
| 34 | } |
||
| 35 | |||
| 63 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: