Conditions | 6 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
26 | public function reverseTransform($url): ?string |
||
27 | { |
||
28 | if (null === $url || '' === $url || !is_string($url)) { |
||
29 | return null; |
||
30 | } |
||
31 | |||
32 | try { |
||
33 | $res = parse_url($url, PHP_URL_HOST); |
||
34 | if (null === $res) { |
||
35 | return $url; |
||
36 | } |
||
37 | |||
38 | return $res; |
||
39 | } catch (UrlException $e) { |
||
40 | throw new TransformationFailedException(\Safe\sprintf('It was not possible to extract the host from the url: "%s"', $url), 0, $e); |
||
41 | } |
||
44 |