1 | <?php namespace Neomerx\Cors\Http; |
||
25 | class ParsedUrl implements ParsedUrlInterface |
||
26 | { |
||
27 | /** Key for result from parse_url() function */ |
||
28 | const URL_KEY_SCHEME = 'scheme'; |
||
29 | |||
30 | /** Key for result from parse_url() function */ |
||
31 | const URL_KEY_HOST = 'host'; |
||
32 | |||
33 | /** Key for result from parse_url() function */ |
||
34 | const URL_KEY_PORT = 'port'; |
||
35 | |||
36 | /** |
||
37 | * @var string|null |
||
38 | */ |
||
39 | private $scheme; |
||
40 | |||
41 | /** |
||
42 | * @var string|null |
||
43 | */ |
||
44 | private $host; |
||
45 | |||
46 | /** |
||
47 | * @var int |
||
48 | */ |
||
49 | private $port; |
||
50 | |||
51 | /** |
||
52 | * @var null|string |
||
53 | */ |
||
54 | private $urlAsString; |
||
55 | |||
56 | /** |
||
57 | * @param string|array $url |
||
58 | */ |
||
59 | 19 | public function __construct($url) |
|
77 | |||
78 | /** |
||
79 | * @inheritdoc |
||
80 | */ |
||
81 | 6 | public function getScheme() |
|
85 | |||
86 | /** |
||
87 | * @inheritdoc |
||
88 | */ |
||
89 | 14 | public function getHost() |
|
93 | |||
94 | /** |
||
95 | * @inheritdoc |
||
96 | */ |
||
97 | 15 | public function getPort() |
|
101 | |||
102 | /** |
||
103 | * @inheritdoc |
||
104 | */ |
||
105 | 13 | public function getOrigin() |
|
117 | |||
118 | /** |
||
119 | * @inheritdoc |
||
120 | */ |
||
121 | 2 | public function isSchemeEqual(ParsedUrlInterface $rhs) |
|
125 | |||
126 | /** |
||
127 | * @inheritdoc |
||
128 | */ |
||
129 | 10 | public function isHostEqual(ParsedUrlInterface $rhs) |
|
133 | |||
134 | /** |
||
135 | * @inheritdoc |
||
136 | */ |
||
137 | 11 | public function isPortEqual(ParsedUrlInterface $rhs) |
|
141 | |||
142 | /** |
||
143 | * @inheritDoc |
||
144 | */ |
||
145 | 1 | public function __toString() |
|
149 | |||
150 | /** |
||
151 | * @param array $array |
||
152 | * @param string $key |
||
153 | * @param mixed $default |
||
154 | * |
||
155 | * @return mixed |
||
156 | */ |
||
157 | 18 | private function getArrayValue(array $array, $key, $default = null) |
|
161 | } |
||
162 |