Passed
Pull Request — main (#10)
by Artem
02:23
created

UserPicture::isDefault()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace CloudPlayDev\ConfluenceClient\Entity;
5
6
use Webmozart\Assert\Assert;
7
8
class UserPicture implements Hydratable
9
{
10
11
    private string $path;
12
    private int $width;
13
    private int $height;
14
    private bool $isDefault;
15
16
    public static function load(array $data): Hydratable
17
    {
18
        $userPicture = new self;
19
        Assert::string($data['path']);
20
        Assert::numeric($data['width']);
21
        Assert::numeric($data['height']);
22
        Assert::boolean($data['isDefault']);
23
24
        $userPicture->setPath($data['path']);
25
        $userPicture->setWidth($data['width']);
26
        $userPicture->setHeight($data['height']);
27
        $userPicture->setIsDefault($data['isDefault']);
28
29
30
        return $userPicture;
31
    }
32
33
    private function setPath(string $path)
34
    {
35
        $this->path = $path;
36
    }
37
38
    private function setWidth(int $width)
39
    {
40
        $this->width = $width;
41
    }
42
43
    private function setHeight(int $height)
44
    {
45
        $this->height = $height;
46
    }
47
48
    private function setIsDefault(bool $isDefault)
49
    {
50
        $this->isDefault = $isDefault;
51
    }
52
53
    public function getPath(): string
54
    {
55
        return $this->path;
56
    }
57
58
    public function getWidth(): int
59
    {
60
        return $this->width;
61
    }
62
63
    public function getHeight(): int
64
    {
65
        return $this->height;
66
    }
67
68
    public function isDefault(): bool
69
    {
70
        return $this->isDefault;
71
    }
72
73
74
}
75