UserPicture::setIsDefault()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
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): UserPicture
17
    {
18
        $userPicture = new self;
19
        Assert::string($data['path']);
20
        Assert::integer($data['width']);
21
        Assert::integer($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): UserPicture
34
    {
35
        $this->path = $path;
36
        return $this;
37
    }
38
39
    private function setWidth(int $width): UserPicture
40
    {
41
        $this->width = $width;
42
        return $this;
43
    }
44
45
    private function setHeight(int $height): UserPicture
46
    {
47
        $this->height = $height;
48
        return $this;
49
    }
50
51
    private function setIsDefault(bool $isDefault): UserPicture
52
    {
53
        $this->isDefault = $isDefault;
54
        return $this;
55
    }
56
57
    public function getPath(): string
58
    {
59
        return $this->path;
60
    }
61
62
    public function getWidth(): int
63
    {
64
        return $this->width;
65
    }
66
67
    public function getHeight(): int
68
    {
69
        return $this->height;
70
    }
71
72
    public function isDefault(): bool
73
    {
74
        return $this->isDefault;
75
    }
76
77
78
}
79