Code Duplication    Length = 19-19 lines in 2 locations

src/Message/Body.php 1 location

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

src/Message/ProtocolVersion.php 1 location

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