Line   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getY2() 0 3 1
A __construct() 0 5 1
A getX2() 0 3 1
A getThickness() 0 3 1
A getColor() 0 3 1
1
<?php
2
3
namespace EaselDrawing\Elements;
4
5
use EaselDrawing\AbstractElement;
6
use EaselDrawing\Color;
7
8
class Line extends AbstractElement
9
{
10
    /** @var int border weight */
11
    private $thickness;
12
13
    /** @var Color */
14
    private $color;
15
16
    /**
17
     * Rectangle constructor.
18
     * @param int $x
19
     * @param int $y
20
     * @param int $width
21
     * @param int $height
22
     * @param Color $color
23
     * @param int $thickness
24
     */
25
    public function __construct(int $x, int $y, int $width, int $height, Color $color, $thickness = 1)
26
    {
27
        parent::__construct($x, $y, $width, $height);
28
        $this->thickness = $thickness;
29
        $this->color = $color;
30
    }
31
32
    public function getX2(): int
33
    {
34
        return $this->getX() + $this->getWidth();
35
    }
36
37
    public function getY2(): int
38
    {
39
        return $this->getY() + $this->getHeight();
40
    }
41
42
    public function getThickness(): int
43
    {
44
        return $this->thickness;
45
    }
46
47
    public function getColor(): Color
48
    {
49
        return $this->color;
50
    }
51
}
52