Code Duplication    Length = 19-19 lines in 3 locations

src/Request/Method.php 1 location

@@ 8-26 (lines=19) @@
5
use Psr\Http\Message\RequestInterface;
6
use Psr7Unitesting\Utils\ValueConstraintTrait;
7
8
class Method extends AbstractConstraint
9
{
10
    use ValueConstraintTrait;
11
12
    public function toString()
13
    {
14
        return sprintf('has the method "%s"', $this->expected);
15
    }
16
17
    protected function runMatches(RequestInterface $request)
18
    {
19
        return $request->getMethod() == $this->expected;
20
    }
21
22
    protected function additionalFailureDescription($request)
23
    {
24
        return sprintf('"%s" returned', $request->getMethod());
25
    }
26
}
27

src/Request/RequestTarget.php 1 location

@@ 8-26 (lines=19) @@
5
use Psr\Http\Message\RequestInterface;
6
use Psr7Unitesting\Utils\ValueConstraintTrait;
7
8
class RequestTarget extends AbstractConstraint
9
{
10
    use ValueConstraintTrait;
11
12
    public function toString()
13
    {
14
        return sprintf('has the request target "%s"', $this->expected);
15
    }
16
17
    protected function runMatches(RequestInterface $request)
18
    {
19
        return $request->getRequestTarget() == $this->expected;
20
    }
21
22
    protected function additionalFailureDescription($request)
23
    {
24
        return sprintf('"%s" returned', $request->getRequestTarget());
25
    }
26
}
27

src/Request/Uri.php 1 location

@@ 8-26 (lines=19) @@
5
use Psr\Http\Message\RequestInterface;
6
use Psr7Unitesting\Utils\ValueConstraintTrait;
7
8
class Uri extends AbstractConstraint
9
{
10
    use ValueConstraintTrait;
11
12
    public function toString()
13
    {
14
        return sprintf('has the uri "%s"', $this->expected);
15
    }
16
17
    protected function runMatches(RequestInterface $request)
18
    {
19
        return (string) $request->getUri() == $this->expected;
20
    }
21
22
    protected function additionalFailureDescription($request)
23
    {
24
        return sprintf('"%s" returned', (string) $request->getUri());
25
    }
26
}
27