File: src/Generics/Util/EndpointParser.php

Recommend this page to a friend!
  Classes of Maik Greubel  >  PHP Generics  >  src/Generics/Util/EndpointParser.php  >  Download  
File: src/Generics/Util/EndpointParser.php
Role: Class source
Content type: text/plain
Description: EndpointParser class
Class: PHP Generics
Framework for accessing streams, sockets and logs
Author: By
Last change: Add strict return types & fix socket write bug
Date: 3 years ago
Size: 690 bytes
 

Contents

Class file image Download
<?php

/**
 * This file is part of the PHP Generics package.
 *
 * @package Generics
 */
namespace Generics\Util;

use
Generics\Socket\Endpoint;
use
Generics\Socket\InvalidUrlException;

/**
 * This class provides a parser to retrieve Endpoint objects out of arbitrary URIs
 *
 * @author Maik Greubel <greubel@nkey.de>
 */
class EndpointParser
{

   
/**
     * Parse a URI into a Endpoint
     *
     * @param string $url
     * @throws InvalidUrlException
     * @return \Generics\Socket\Endpoint
     */
   
public static function parseUrl($url): Endpoint
   
{
       
$url = UrlParser::parseUrl($url);
       
        return new
Endpoint($url->getAddress(), $url->getPort());
    }
}


For more information send a message to info at phpclasses dot org.