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

ReplaceUriPlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A doHandleRequest() 0 6 1
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