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

RequestFactory::createRequest()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 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