1 | <?php |
||
21 | class Url |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $hostname; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $scheme; |
||
32 | |||
33 | /** |
||
34 | * @var integer |
||
35 | */ |
||
36 | protected $port; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $queryDelimiter; |
||
42 | |||
43 | /** |
||
44 | * The constructor class. |
||
45 | * |
||
46 | * @param string $hostname The hostname for url of Rest. |
||
47 | * @param string $scheme The scheme for url of Rest. |
||
48 | * @param integer $port The port for url of Rest. |
||
49 | * @param string $queryDelimiter The query delimiter for url of Rest. |
||
50 | */ |
||
51 | public function __construct($hostname, $scheme, $port, $queryDelimiter) |
||
58 | |||
59 | /** |
||
60 | * The getter for hostname. |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getHostname() |
||
68 | |||
69 | /** |
||
70 | * The getter for scheme. |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getScheme() |
||
78 | |||
79 | /** |
||
80 | * The getter for port. |
||
81 | * |
||
82 | * @return integer |
||
83 | */ |
||
84 | public function getPort() |
||
92 | |||
93 | /** |
||
94 | * The getter for queryDelimiter. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getQueryDelimiter() |
||
102 | |||
103 | /** |
||
104 | * The getter for uri. |
||
105 | * |
||
106 | * @param string $path The path of the url. |
||
107 | * @param array $query The query to pass to the URL (default empty). |
||
108 | * |
||
109 | * @return string |
||
110 | */ |
||
111 | public function getUriForPath($path, array $query = []) |
||
118 | |||
119 | /** |
||
120 | * Builds the full base url. |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | protected function buildBaseUrl() |
||
136 | |||
137 | /** |
||
138 | * Builds the list of query paramaters. |
||
139 | * |
||
140 | * @param array $query The data to pass to the URL (default empty). |
||
141 | * |
||
142 | * @return string |
||
143 | */ |
||
144 | protected function buildQuery(array $query = []) |
||
157 | } |
||
158 |