| Conditions | 4 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 78 | protected function transformUrl(string $url, string $prefix = 'test') |
|
| 15 | { |
||
| 16 | 78 | $check = $this->environment; |
|
|
|
|||
| 17 | |||
| 18 | 78 | if ($check === 'test' || $check === 'local' || $check === 'testing') { |
|
| 19 | 16 | return http_build_url($url, ['host' => $prefix.parse_url($url)['host']]); |
|
| 20 | } |
||
| 21 | |||
| 22 | 62 | return $url; |
|
| 23 | } |
||
| 24 | } |
||
| 25 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: