Code Duplication    Length = 19-19 lines in 8 locations

src/Uri/Authority.php 1 location

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

src/Uri/Fragment.php 1 location

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

src/Uri/Host.php 1 location

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

src/Uri/Path.php 1 location

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

src/Uri/Port.php 1 location

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

src/Uri/Query.php 1 location

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

src/Uri/Scheme.php 1 location

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

src/Uri/UserInfo.php 1 location

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