Blocks
4 months ago
Contracts
9 months ago
Errors
3 weeks ago
Scripts
1 month ago
Arrays.php
3 years ago
ColorService.php
3 years ago
Currency.php
1 year ago
Encryption.php
3 years ago
Interval.php
6 months ago
Server.php
2 years ago
TimeDate.php
2 months ago
Translations.php
3 years ago
URL.php
2 years ago
UtilityService.php
3 years ago
UtilityServiceProvider.php
3 years ago
kses.json
5 hours ago
URL.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Support; |
| 4 | |
| 5 | /** |
| 6 | * Handles currency coversion and formatting |
| 7 | */ |
| 8 | class URL { |
| 9 | /** |
| 10 | * Get the scheme and http host. |
| 11 | * |
| 12 | * @param string $url The url. |
| 13 | * |
| 14 | * @return string |
| 15 | */ |
| 16 | public static function getSchemeAndHttpHost( string $url ): string { |
| 17 | if ( empty( $url ) ) { |
| 18 | return ''; |
| 19 | } |
| 20 | |
| 21 | $parsed_url = parse_url( $url ); |
| 22 | |
| 23 | if ( empty( $parsed_url['scheme'] ) || empty( $parsed_url['host'] ) ) { |
| 24 | return ''; |
| 25 | } |
| 26 | |
| 27 | return $parsed_url['scheme'] . '://' . $parsed_url['host']; |
| 28 | } |
| 29 | } |
| 30 |