1 | <?php |
||
12 | class Url |
||
13 | { |
||
14 | /** |
||
15 | * URL to build. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | private $url = ''; |
||
20 | /** |
||
21 | * URL components. |
||
22 | * |
||
23 | * @var string[] |
||
24 | */ |
||
25 | private $components = []; |
||
26 | |||
27 | /** |
||
28 | * Url constructor. |
||
29 | * |
||
30 | * @param string $baseUrl |
||
31 | * Base URL. |
||
32 | * @param string $path |
||
33 | * Path on a base URL. |
||
34 | */ |
||
35 | public function __construct($baseUrl, $path = '') |
||
48 | |||
49 | /** |
||
50 | * @return string |
||
51 | * Constructed URL. |
||
52 | */ |
||
53 | public function __toString() |
||
57 | |||
58 | /** |
||
59 | * Initialize URL creation. |
||
60 | * |
||
61 | * @param string $url |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | private function setUrl($url) |
||
76 | |||
77 | /** |
||
78 | * Append HTTP scheme. |
||
79 | * |
||
80 | * @return $this |
||
81 | */ |
||
82 | private function scheme() |
||
98 | |||
99 | /** |
||
100 | * Append authentication credentials. |
||
101 | * |
||
102 | * @return $this |
||
103 | */ |
||
104 | private function credentials() |
||
116 | |||
117 | /** |
||
118 | * Append host. |
||
119 | * |
||
120 | * @return $this |
||
121 | */ |
||
122 | private function host() |
||
128 | |||
129 | /** |
||
130 | * Append additional URL components. |
||
131 | * |
||
132 | * @return $this |
||
133 | */ |
||
134 | private function components() |
||
144 | } |
||
145 |