1 | <?php |
||
8 | class UrlBuilder |
||
9 | { |
||
10 | /** |
||
11 | * The base URL. |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $baseUrl; |
||
15 | |||
16 | /** |
||
17 | * Whether the base URL is a relative domain. |
||
18 | * @var bool |
||
19 | */ |
||
20 | protected $isRelativeDomain = false; |
||
21 | |||
22 | /** |
||
23 | * The HTTP signature used to sign URLs. |
||
24 | * @var SignatureInterface |
||
25 | */ |
||
26 | protected $signature; |
||
27 | |||
28 | /** |
||
29 | * Create UrlBuilder instance. |
||
30 | * @param string $baseUrl The base URL. |
||
31 | * @param SignatureInterface|null $signature The HTTP signature used to sign URLs. |
||
32 | */ |
||
33 | public function __construct($baseUrl = '', SignatureInterface $signature = null) |
||
38 | |||
39 | /** |
||
40 | * Set the base URL. |
||
41 | * @param string $baseUrl The base URL. |
||
42 | */ |
||
43 | public function setBaseUrl($baseUrl) |
||
52 | |||
53 | /** |
||
54 | * Set the HTTP signature. |
||
55 | * @param SignatureInterface|null $signature The HTTP signature used to sign URLs. |
||
56 | */ |
||
57 | public function setSignature(SignatureInterface $signature = null) |
||
61 | |||
62 | /** |
||
63 | * Get the URL. |
||
64 | * @param string $path The resource path. |
||
65 | * @param array $params The manipulation parameters. |
||
66 | * @return string The URL. |
||
67 | */ |
||
68 | public function getUrl($path, array $params = []) |
||
84 | |||
85 | /** |
||
86 | * Build the URL. |
||
87 | * @param array $parts The URL parts. |
||
88 | * @param array $params The manipulation parameters. |
||
89 | * @return string The built URL. |
||
90 | */ |
||
91 | protected function buildUrl($parts, $params) |
||
115 | } |
||
116 |