Canvas::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 1

Size

Total Lines 14
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 6
nc 1
nop 6
dl 0
loc 14
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
namespace EaselDrawing;
4
5
class Canvas
6
{
7
    /** @var int */
8
    private $width;
9
    /** @var int */
10
    private $height;
11
    /** @var Elements */
12
    private $elements;
13
    /** @var Color */
14
    private $background;
15
    /** @var bool */
16
    private $grayScale;
17
    /** @var Orientation */
18
    private $orientation;
19
20
    public function __construct(
21
        int $width,
22
        int $height,
23
        Color $background = null,
24
        Elements $elements = null,
25
        bool $grayScale = false,
26
        Orientation $orientation = null
27
    ) {
28
        $this->width = $width;
29
        $this->height = $height;
30
        $this->elements = $elements ? : new Elements();
31
        $this->background = $background ? : new Color(255, 255, 255);
32
        $this->grayScale = $grayScale;
33
        $this->orientation = $orientation ? : new Orientation(Orientation::LANDSCAPE);
34
    }
35
36
    public function getWidth(): int
37
    {
38
        return $this->width;
39
    }
40
41
    public function getHeight(): int
42
    {
43
        return $this->height;
44
    }
45
46
    public function getElements(): Elements
47
    {
48
        return $this->elements;
49
    }
50
51
    public function getBackground(): Color
52
    {
53
        return $this->background;
54
    }
55
56
    public function isGrayScale(): bool
57
    {
58
        return $this->grayScale;
59
    }
60
61
    public function getOrientation(): Orientation
62
    {
63
        return $this->orientation;
64
    }
65
}
66