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

ErrorLinePlot   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 39
ccs 0
cts 20
cp 0
rs 10
c 2
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A Legend() 0 7 2
A Stroke() 0 4 1
1
<?php
2
3
/**
4
 * JPGraph v4.0.3
5
 */
6
7
namespace Amenadiel\JpGraph\Plot;
8
9
/**
10
 * @class ErrorLinePlot
11
 * // Description: Combine a line and error plot
12
 * // THIS IS A DEPRECATED PLOT TYPE JUST KEPT FOR
13
 * // BACKWARD COMPATIBILITY
14
 */
15
class ErrorLinePlot extends ErrorPlot
16
{
17
    public $line;
18
19
    /**
20
     * CONSTRUCTOR.
21
     *
22
     * @param mixed $datay
23
     * @param mixed $datax
24
     */
25
    public function __construct($datay, $datax = false)
26
    {
27
        parent::__construct($datay, $datax);
28
        // Calculate line coordinates as the average of the error limits
29
        $n = safe_count($datay);
30
        for ($i = 0; $i < $n; $i += 2) {
31
            $ly[] = ($datay[$i] + $datay[$i + 1]) / 2;
32
        }
33
        $this->line = new LinePlot($ly, $datax);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $ly does not seem to be defined for all execution paths leading up to this point.
Loading history...
34
    }
35
36
    /**
37
     * PUBLIC METHODS.
38
     *
39
     * @param mixed $graph
40
     */
41
    public function Legend($graph)
42
    {
43
        if ($this->legend != '') {
44
            $graph->legend->Add($this->legend, $this->color);
45
        }
46
47
        $this->line->Legend($graph);
48
    }
49
50
    public function Stroke($img, $xscale, $yscale)
51
    {
52
        parent::Stroke($img, $xscale, $yscale);
53
        $this->line->Stroke($img, $xscale, $yscale);
54
    }
55
} // @class
56