Completed
Push — master ( 398989...6954b4 )
by Tobias
29:12 queued 04:09
created

ReplaceUriPlugin::doHandleRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (C) 2013 Mailgun
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license. See the LICENSE file for details.
10
 */
11
12
namespace Mailgun\HttpClient\Plugin;
13
14
use Http\Client\Common\Plugin;
15
use Psr\Http\Message\RequestInterface;
16
use Psr\Http\Message\UriInterface;
17
18
/**
19
 * Replaces a URI with a new one. Good for debugging.
20
 *
21
 * @author Tobias Nyholm <[email protected]>
22
 */
23
final class ReplaceUriPlugin implements Plugin
24
{
25
    use Plugin\VersionBridgePlugin;
26
27
    /**
28
     * @var UriInterface
29
     */
30
    private $uri;
31
32
    public function __construct(UriInterface $uri)
33
    {
34
        $this->uri = $uri;
35
    }
36
37
    public function doHandleRequest(RequestInterface $request, callable $next, callable $first)
0 ignored issues
show
Unused Code introduced by
The parameter $first is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        $request = $request->withUri($this->uri);
40
41
        return $next($request);
42
    }
43
}
44