Passed
Push — master ( 81d6e9...d00c23 )
by Felipe
04:07
created

src/graph/PolarLogScale.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * JPGraph v3.6.15
5
 */
6
7
namespace Amenadiel\JpGraph\Graph;
8
9
class PolarLogScale extends LogScale
10
{
11
    private $graph;
12
    public $clockwise = false;
13
14
    public function __construct($aMax, $graph, $aClockwise = false)
15
    {
16
        parent::__construct(0, $aMax, 'x');
17
        $this->graph = $graph;
18
        $this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE);
0 ignored issues
show
The method SetLabelLogType() does not exist on Amenadiel\JpGraph\Graph\LinearTicks. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        $this->ticks->/** @scrutinizer ignore-call */ 
19
                      SetLabelLogType(LOGLABELS_MAGNITUDE);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
19
        $this->clockwise = $aClockwise;
20
    }
21
22
    public function SetClockwise($aFlg)
23
    {
24
        $this->clockwise = $aFlg;
25
    }
26
27
    public function PTranslate($aAngle, $aRad)
28
    {
29
        if ($aRad == 0) {
30
            $aRad = 1;
31
        }
32
33
        $aRad = log10($aRad);
34
        $m    = $this->scale[1];
35
        $w    = $this->graph->img->plotwidth / 2;
36
        $aRad = $aRad / $m * $w;
37
38
        $a = $aAngle / 180 * M_PI;
39
        if ($this->clockwise) {
40
            $a = 2 * M_PI - $a;
41
        }
42
43
        $x = cos($a) * $aRad;
44
        $y = sin($a) * $aRad;
45
46
        $x += $w + $this->graph->img->left_margin; //$this->_Translate(0);
47
        if ($this->graph->iType == POLAR_360) {
48
            $y = ($this->graph->img->top_margin + $this->graph->img->plotheight / 2) - $y;
49
        } else {
50
            $y = ($this->graph->img->top_margin + $this->graph->img->plotheight) - $y;
51
        }
52
53
        return [$x, $y];
54
    }
55
}
56