Completed
Push — master ( c2d3d8...f8aacf )
by Josh
8s
created

RequestFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

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
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
    public function createRequest($method, $uri)
16
    {
17
        if (!$uri instanceof UriInterface) {
18
            $uri = new Uri($uri);
19
        }
20
21
        return (new Request())
22
            ->withMethod($method)
23
            ->withUri($uri);
24
    }
25
}
26