RequestFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createRequest() 0 10 2
1
<?php
2
3
namespace CodeJet\Http\Factory;
4
5
use CodeJet\Http\Request;
6
use CodeJet\Http\Uri;
7
use Interop\Http\Factory\RequestFactoryInterface;
8
use Psr\Http\Message\UriInterface;
9
10
class RequestFactory implements RequestFactoryInterface
11
{
12
    /**
13
     * @inheritdoc
14
     */
15 21
    public function createRequest($method, $uri)
16
    {
17 21
        if (!$uri instanceof UriInterface) {
18 18
            $uri = new Uri($uri);
19
        }
20
21 21
        return (new Request())
22 21
            ->withMethod($method)
23 21
            ->withUri($uri);
24
    }
25
}
26