Test Failed
Pull Request — master (#144)
by
unknown
05:06
created

LineProperty::Stroke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 10
nc 2
nop 5
dl 0
loc 12
ccs 0
cts 12
cp 0
crap 6
rs 9.9332
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
    public function __construct($aWeight = 1, $aColor = 'black', $aStyle = 'solid')
21
    {
22
        $this->iWeight = $aWeight;
23
        $this->iColor  = $aColor;
24
        $this->iStyle  = $aStyle;
25
    }
26
27
    public function SetColor($aColor)
28
    {
29
        $this->iColor = $aColor;
30
    }
31
32
    public function SetWeight($aWeight)
33
    {
34
        $this->iWeight = $aWeight;
35
    }
36
37
    public function SetStyle($aStyle)
38
    {
39
        $this->iStyle = $aStyle;
40
    }
41
42
    public function Show($aShow = true)
43
    {
44
        $this->iShow = $aShow;
45
    }
46
47
    public function Stroke($aImg, $aX1, $aY1, $aX2, $aY2)
48
    {
49
        if ($this->iShow) {
50
            $aImg->PushColor($this->iColor);
51
            $oldls = $aImg->line_style;
52
            $oldlw = $aImg->line_weight;
53
            $aImg->SetLineWeight($this->iWeight);
54
            $aImg->SetLineStyle($this->iStyle);
55
            $aImg->StyleLine($aX1, $aY1, $aX2, $aY2);
56
            $aImg->PopColor($this->iColor);
57
            $aImg->line_style  = $oldls;
58
            $aImg->line_weight = $oldlw;
59
        }
60
    }
61
}
62