LeagueUriAdapter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 24
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isInstalled() 0 3 1
A createUri() 0 3 1
A factory() 0 3 1
1
<?php
2
3
namespace BenTools\UriFactory\Adapter;
4
5
use BenTools\UriFactory\UriFactoryInterface;
6
use League\Uri\Factory;
7
use League\Uri\Http;
8
use Psr\Http\Message\UriInterface;
9
10
final class LeagueUriAdapter implements AdapterInterface
11
{
12
    /**
13
     * @inheritDoc
14
     */
15
    public function createUri(string $uri = ''): UriInterface
16
    {
17
        return Http::createFromString($uri);
18
    }
19
20
    /**
21
     * @inheritDoc
22
     */
23
    public static function factory(): UriFactoryInterface
24
    {
25
        return new self;
26
    }
27
28
    /**
29
     * @inheritDoc
30
     */
31
    public static function isInstalled(): bool
32
    {
33
        return class_exists('League\Uri\Http');
34
    }
35
}
36