GuzzleAdapter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
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 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