Commit | Line | Data |
---|---|---|
f9bdf062 | 1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
f9bdf062 | 5 | | | |
bc77d7c0 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
f9bdf062 | 9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | use GuzzleHttp\Psr7\Uri; | |
13 | use Psr\Http\Message\UriInterface; | |
14 | ||
15 | class CRM_Utils_Url { | |
16 | ||
17 | /** | |
18 | * Parse url to a UriInterface. | |
19 | * | |
20 | * @param string $url | |
21 | * | |
4e0369d7 | 22 | * @return \Psr\Http\Message\UriInterface |
f9bdf062 | 23 | */ |
24 | public static function parseUrl($url) { | |
25 | return new Uri($url); | |
26 | } | |
27 | ||
28 | /** | |
29 | * Unparse url back to a string. | |
30 | * | |
4e0369d7 | 31 | * @param \Psr\Http\Message\UriInterface $parsed |
f9bdf062 | 32 | * |
33 | * @return string | |
34 | */ | |
35 | public static function unparseUrl(UriInterface $parsed) { | |
36 | return $parsed->__toString(); | |
37 | } | |
38 | ||
39 | } |