1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace VDB\Spider\Uri; |
4
|
|
|
|
5
|
|
|
use VDB\Uri\UriInterface; |
6
|
|
|
|
7
|
|
|
abstract class UriDecorator implements UriInterface |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var UriInterface |
11
|
|
|
*/ |
12
|
|
|
protected $decorated; |
13
|
|
|
|
14
|
|
|
public function __construct(UriInterface $decorated) |
15
|
|
|
{ |
16
|
|
|
$this->decorated = $decorated; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function toString() |
20
|
|
|
{ |
21
|
|
|
return $this->decorated->toString(); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @param UriInterface $that |
26
|
|
|
* @param boolean $normalized whether to compare normalized versions of the URIs |
27
|
|
|
* @return boolean |
28
|
|
|
*/ |
29
|
|
|
public function equals(UriInterface $that, $normalized = false) |
30
|
|
|
{ |
31
|
|
|
return $this->decorated->equals($that, $normalized); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return UriInterface |
36
|
|
|
*/ |
37
|
|
|
public function normalize() |
38
|
|
|
{ |
39
|
|
|
return $this->decorated->normalize(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Alias of Uri::toString() |
44
|
|
|
* |
45
|
|
|
* @return string |
46
|
|
|
*/ |
47
|
|
|
public function __toString() |
48
|
|
|
{ |
49
|
|
|
return $this->decorated->__toString(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string|null |
54
|
|
|
*/ |
55
|
|
|
public function getHost() |
56
|
|
|
{ |
57
|
|
|
return $this->decorated->getHost(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return string|null |
62
|
|
|
*/ |
63
|
|
|
public function getPassword() |
64
|
|
|
{ |
65
|
|
|
return $this->decorated->getPassword(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return string|null |
70
|
|
|
*/ |
71
|
|
|
public function getPath() |
72
|
|
|
{ |
73
|
|
|
return $this->decorated->getPath(); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return int|null |
78
|
|
|
*/ |
79
|
|
|
public function getPort() |
80
|
|
|
{ |
81
|
|
|
return $this->decorated->getPort(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return string|null |
86
|
|
|
*/ |
87
|
|
|
public function getQuery() |
88
|
|
|
{ |
89
|
|
|
return $this->decorated->getQuery(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return string|null |
94
|
|
|
*/ |
95
|
|
|
public function getScheme() |
96
|
|
|
{ |
97
|
|
|
return $this->decorated->getScheme(); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string|null |
102
|
|
|
*/ |
103
|
|
|
public function getUsername() |
104
|
|
|
{ |
105
|
|
|
return $this->decorated->getUsername(); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return string|null |
110
|
|
|
*/ |
111
|
|
|
public function getFragment() |
112
|
|
|
{ |
113
|
|
|
return $this->decorated->getFragment(); |
114
|
|
|
} |
115
|
|
|
} |
116
|
|
|
|