PageSize   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 63
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getValue() 0 4 1
A isApplied() 0 4 1
A getUri() 0 4 1
A jsonSerialize() 0 8 1
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