UriPathMatches   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A assert() 0 8 2
1
<?php
2
3
namespace Muzzle\Assertions;
4
5
use GuzzleHttp\Psr7\Uri;
6
use GuzzleHttp\Psr7\UriResolver;
7
use Muzzle\Messages\Transaction;
8
use Muzzle\Muzzle;
9
10
class UriPathMatches implements Assertion
11
{
12
13
    /**
14
     * @var Muzzle
15
     */
16
    private $muzzle;
17
18
    public function __construct(Muzzle $muzzle)
19
    {
20
21
        $this->muzzle = $muzzle;
22
    }
23
24
    public function assert(Transaction $actual, Transaction $expected) : void
25
    {
26
27
        $actual->request()->assertUriPath(
0 ignored issues
show
Bug introduced by
The method assertUriPath() does not exist on Psr\Http\Message\RequestInterface. It seems like you code against a sub-type of Psr\Http\Message\RequestInterface such as Muzzle\Messages\AssertableRequest. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
        $actual->request()->/** @scrutinizer ignore-call */ assertUriPath(
Loading history...
28
            UriResolver::resolve(
29
                $this->muzzle->getConfig('base_uri') ?: new Uri,
30
                $expected->request()->getUri()
31
            )->getPath()
32
        );
33
    }
34
}
35