Completed
Push — master ( 039dcf...417ea8 )
by Maik
03:08
created

EndpointParser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
lcom 0
cbo 3
dl 0
loc 17
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseUrl() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of the PHP Generics package.
5
 *
6
 * @package Generics
7
 */
8
namespace Generics\Util;
9
10
use Generics\Socket\Endpoint;
11
use Generics\Socket\InvalidUrlException;
12
13
/**
14
 * This class provides a parser to retrieve Endpoint objects out of arbitrary URIs
15
 *
16
 * @author Maik Greubel <[email protected]>
17
 */
18
class EndpointParser
19
{
20
21
    /**
22
     * Parse a URI into a Endpoint
23
     *
24
     * @param string $url
25
     * @throws InvalidUrlException
26
     * @return \Generics\Socket\Endpoint
27
     */
28 2
    public static function parseUrl($url): Endpoint
29
    {
30 2
        $url = UrlParser::parseUrl($url);
31
        
32 1
        return new Endpoint($url->getAddress(), $url->getPort());
33
    }
34
}
35