Merge pull request #15901 from eileenmcnaughton/matt
[civicrm-core.git] / CRM / Utils / Url.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 |
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 *
22 * @return \GuzzleHttp\Psr7\UriInterface
23 */
24 public static function parseUrl($url) {
25 return new Uri($url);
26 }
27
28 /**
29 * Unparse url back to a string.
30 *
31 * @param \GuzzleHttp\Psr7\UriInterface $parsed
32 *
33 * @return string
34 */
35 public static function unparseUrl(UriInterface $parsed) {
36 return $parsed->__toString();
37 }
38
39 }