RequestFactoryMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 24
rs 10
ccs 5
cts 5
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A applyRequest() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of Guzzle HTTP JSON-RPC
5
 *
6
 * Copyright (c) 2014 Nature Delivered Ltd. <http://graze.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @see  http://github.com/graze/guzzle-jsonrpc/blob/master/LICENSE
12
 * @link http://github.com/graze/guzzle-jsonrpc
13
 */
14
15
namespace Graze\GuzzleHttp\JsonRpc\Middleware;
16
17
use Graze\GuzzleHttp\JsonRpc\Message\MessageFactoryInterface;
18
use Psr\Http\Message\RequestInterface as HttpRequestInterface;
19
20
class RequestFactoryMiddleware extends AbstractMiddleware
21
{
22
    /**
23
     * @var MessageFactoryInterface
24
     */
25
    protected $factory;
26
27
    /**
28
     * @param MessageFactoryInterface $factory
29
     */
30 15
    public function __construct(MessageFactoryInterface $factory)
31
    {
32 15
        $this->factory = $factory;
33 15
    }
34
35
    /**
36
     * @param  HttpRequestInterface $request
37
     * @param  array                $options
38
     *
39
     * @return HttpRequestInterface
40
     */
41 1
    public function applyRequest(HttpRequestInterface $request, array $options)
42
    {
43 1
        return $this->factory->fromRequest($request);
44
    }
45
}
46