LeagueUriAdapter::factory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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