PageSize::getUri()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BenTools\OpenCubes\Component\Pager\Model;
4
5
use Psr\Http\Message\UriInterface;
6
use function BenTools\OpenCubes\stringify_uri;
7
8
final class PageSize implements \JsonSerializable
9
{
10
    /**
11
     * @var int
12
     */
13
    private $value;
14
15
    /**
16
     * @var UriInterface
17
     */
18
    private $uri;
19
20
    /**
21
     * @var bool
22
     */
23
    private $applied;
24
25
    /**
26
     * PageSize constructor.
27
     */
28
    public function __construct(int $value, bool $applied, UriInterface $uri)
29
    {
30
        $this->value = $value;
31
        $this->applied = $applied;
32
        $this->uri = $uri;
33
    }
34
35
    /**
36
     * @return int
37
     */
38
    public function getValue(): int
39
    {
40
        return $this->value;
41
    }
42
43
    /**
44
     * @return bool
45
     */
46
    public function isApplied(): bool
47
    {
48
        return $this->applied;
49
    }
50
51
    /**
52
     * @return UriInterface
53
     */
54
    public function getUri(): UriInterface
55
    {
56
        return $this->uri;
57
    }
58
59
    /**
60
     * @inheritDoc
61
     */
62
    public function jsonSerialize()
63
    {
64
        return [
65
            'size' => $this->value,
66
            'is_applied' => $this->isApplied(),
67
            'link' => stringify_uri($this->uri),
68
        ];
69
    }
70
}
71