GuzzleAdapter::factory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
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 GuzzleHttp\Psr7\Uri;
7
use Psr\Http\Message\UriInterface;
8
9
final class GuzzleAdapter implements AdapterInterface
10
{
11
    /**
12
     * GuzzleAdapter constructor.
13
     */
14
    protected function __construct()
15
    {
16
    }
17
18
    /**
19
     * @inheritDoc
20
     */
21
    public function createUri(string $uri = ''): UriInterface
22
    {
23
        return new Uri($uri);
24
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29
    public static function factory(): UriFactoryInterface
30
    {
31
        return new self;
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37
    public static function isInstalled(): bool
38
    {
39
        return class_exists('GuzzleHttp\Psr7\Uri');
40
    }
41
}
42