Passed
Push — hotfix/4.1.1 ( 2d60bf...00eef4 )
by Felipe
04:27
created

LineProperty::SetColor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * JPGraph v4.0.3
5
 */
6
7
namespace Amenadiel\JpGraph\Graph;
8
9
/**
10
 * @class LineProperty
11
 * // Description: Holds properties for a line
12
 */
13
class LineProperty
14
{
15
    public $iWeight = 1;
16
    public $iColor  = 'black';
17
    public $iStyle  = 'solid';
18
    public $iShow   = false;
19
20 4
    public function __construct($aWeight = 1, $aColor = 'black', $aStyle = 'solid')
21
    {
22 4
        $this->iWeight = $aWeight;
23 4
        $this->iColor  = $aColor;
24 4
        $this->iStyle  = $aStyle;
25 4
    }
26
27 1
    public function SetColor($aColor)
28
    {
29 1
        $this->iColor = $aColor;
30 1
    }
31
32 1
    public function SetWeight($aWeight)
33
    {
34 1
        $this->iWeight = $aWeight;
35 1
    }
36
37 1
    public function SetStyle($aStyle)
38
    {
39 1
        $this->iStyle = $aStyle;
40 1
    }
41
42 2
    public function Show($aShow = true)
43
    {
44 2
        $this->iShow = $aShow;
45 2
    }
46
47 1
    public function Stroke($aImg, $aX1, $aY1, $aX2, $aY2)
48
    {
49 1
        if ($this->iShow) {
50 1
            $aImg->PushColor($this->iColor);
51 1
            $oldls = $aImg->line_style;
52 1
            $oldlw = $aImg->line_weight;
53 1
            $aImg->SetLineWeight($this->iWeight);
54 1
            $aImg->SetLineStyle($this->iStyle);
55 1
            $aImg->StyleLine($aX1, $aY1, $aX2, $aY2);
56 1
            $aImg->PopColor($this->iColor);
57 1
            $aImg->line_style  = $oldls;
58 1
            $aImg->line_weight = $oldlw;
59
        }
60 1
    }
61
}
62