Completed
Push — master ( 27493f...f3deef )
by Marcin
01:42
created

ElemAbstract::getPoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Grandstream-XMLApp
4
 *
5
 * Copyright (c) 2017 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 *
12
 * @author  Marcin Pudełek <[email protected]>
13
 */
14
15
16
namespace mrcnpdlk\Grandstream\XMLApp\Application\Model\Components;
17
18
19
use mrcnpdlk\Grandstream\XMLApp\Helper\Color;
20
use mrcnpdlk\Grandstream\XMLApp\Helper\Point;
21
use mrcnpdlk\Grandstream\XMLApp\Helper\Rectangle;
22
use mrcnpdlk\Grandstream\XMLApp\Helper\Vector;
23
24
/**
25
 * Class ElemAbstract
26
 *
27
 * @package mrcnpdlk\Grandstream\XMLApp\Application\Model\Display
28
 */
29
class ElemAbstract
30
{
31
    /**
32
     * @var \mrcnpdlk\Grandstream\XMLApp\Helper\Point
33
     */
34
    protected $oPoint;
35
    /**
36
     * @var \mrcnpdlk\Grandstream\XMLApp\Helper\Rectangle
37
     */
38
    protected $oRectangle;
39
    /**
40
     * @var Color
41
     */
42
    protected $oColorBg;
43
    /**
44
     * @var Color
45
     */
46
    protected $oColorBorder;
47
48
49
    /**
50
     * ElemAbstract constructor.
51
     *
52
     * @param Point|null     $oPoint
53
     * @param Rectangle|null $oRectangle
54
     */
55 1
    public function __construct(Point $oPoint = null, Rectangle $oRectangle = null)
56
    {
57 1
        $this->oPoint     = $oPoint ?? new Point(0, 0);
58 1
        $this->oRectangle = $oRectangle ?? new Rectangle(0, 0);
59 1
    }
60
61
    /**
62
     * @return Rectangle
63
     */
64
    public function getRectangle()
65
    {
66
        return $this->oRectangle;
67
    }
68
69
    /**
70
     * @param Color $oColor
71
     *
72
     * @return $this
73
     */
74
    public function setColorBg(Color $oColor)
75
    {
76
        $this->oColorBg = $oColor;
77
78
        return $this;
79
    }
80
81
    /**
82
     * @return \mrcnpdlk\Grandstream\XMLApp\Helper\Color
83
     */
84
    public function getColorBg()
85
    {
86
        return $this->oColorBg ?? new Color();
87
    }
88
89
    /**
90
     * @param Color $oColor
91
     *
92
     * @return $this
93
     */
94
    public function setColorBorder(Color $oColor)
95
    {
96
        $this->oColorBorder = $oColor;
97
98
        return $this;
99
    }
100
101
    /**
102
     * @return \mrcnpdlk\Grandstream\XMLApp\Helper\Color
103
     */
104
    public function getColorBorder()
105
    {
106
        return $this->oColorBorder ?? new Color(100);
107
    }
108
109
    /**
110
     * @param int $iX
111
     * @param int $iY
112
     *
113
     * @return $this
114
     */
115
    public function move(int $iX, int $iY)
116
    {
117
        $this->getPoint()->move(new Vector($iX, $iY));
118
119
        return $this;
120
    }
121
122
    /**
123
     * @return Point
124
     */
125 1
    public function getPoint()
126
    {
127 1
        return $this->oPoint;
128
    }
129
}
130