Total Complexity | 9 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | class URLInfo_Normalizer |
||
22 | { |
||
23 | /** |
||
24 | * @var URLInfo |
||
25 | */ |
||
26 | protected $info; |
||
27 | |||
28 | public function __construct(URLInfo $info) |
||
29 | { |
||
30 | $this->info = $info; |
||
31 | } |
||
32 | |||
33 | public function normalize() : string |
||
34 | { |
||
35 | $method = 'normalize_'.$this->info->getType(); |
||
36 | |||
37 | return (string)$this->$method(); |
||
38 | } |
||
39 | |||
40 | protected function normalize_fragment() : string |
||
41 | { |
||
42 | return '#'.$this->info->getFragment(); |
||
43 | } |
||
44 | |||
45 | protected function normalize_phone() : string |
||
48 | } |
||
49 | |||
50 | protected function normalize_email() : string |
||
51 | { |
||
52 | return 'mailto:'.$this->info->getPath(); |
||
53 | } |
||
54 | |||
55 | protected function normalize_url() : string |
||
73 | } |
||
74 | } |
||
75 |