UriFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createUri() 0 11 3
1
<?php
2
3
namespace CodeJet\Http\Factory;
4
5
use CodeJet\Http\Uri;
6
use Interop\Http\Factory\UriFactoryInterface;
7
use InvalidArgumentException;
8
9
class UriFactory implements UriFactoryInterface
10
{
11
    /**
12
     * @inheritdoc
13
     */
14 12
    public function createUri($uri = '')
15
    {
16 12
        if (!is_string($uri)) {
17 3
            throw new InvalidArgumentException(sprintf(
18 3
                'URI passed to constructor must be a string; received "%s"',
19 3
                (is_object($uri) ? get_class($uri) : gettype($uri))
20
            ));
21
        }
22
23 9
        return new Uri($uri);
24
    }
25
}
26