Total Complexity | 6 |
Total Lines | 65 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class Url |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | protected $uri; |
||
11 | |||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $params; |
||
16 | |||
17 | /** |
||
18 | * Url constructor. |
||
19 | * |
||
20 | * @param string $uri |
||
21 | * @param array|null $params |
||
22 | */ |
||
23 | public function __construct(string $uri, array $params = null) |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Retrieve a URL with params appended to the query string. |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | public function get(): string |
||
35 | { |
||
36 | return self::generateUrl($this->uri).self::generateQueryString($this->params); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Generate a URL. |
||
41 | * |
||
42 | * @param string $uri |
||
43 | * @return string |
||
44 | */ |
||
45 | public static function generateUrl(string $uri): string |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Generate a query string. |
||
52 | * |
||
53 | * @param array|null $params |
||
54 | * @return string |
||
55 | */ |
||
56 | public static function generateQueryString(array $params = null): string |
||
70 | } |
||
71 | } |
||
72 |