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

LineProperty   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 46
ccs 0
cts 34
cp 0
rs 10
c 0
b 0
f 0
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A SetStyle() 0 3 1
A SetColor() 0 3 1
A Show() 0 3 1
A __construct() 0 5 1
A Stroke() 0 12 2
A SetWeight() 0 3 1
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