GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#88)
by
unknown
12:09
created

Highmap::render()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 69
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 69
rs 9.2083
c 1
b 0
f 0
ccs 0
cts 28
cp 0
cc 3
eloc 25
nc 4
nop 1
crap 12

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Ob\HighchartsBundle\Highcharts;
4
5
/**
6
 * This class is part of the Ob/HighchartsBundle
7
 * See Highcharts documentation at http://www.highcharts.com/ref/
8
 */
9
class Highmap extends AbstractChart implements ChartInterface
10
{
11
    public $colorAxis;
12
    public $mapNavigation;
13
14
    public function __construct()
15
    {
16
        parent::__construct();
17
        $this->initChartOption('colorAxis');
18
        $this->initChartOption('mapNavigation');
19
    }
20
21
    /**
22
     * @param string $engine
23
     *
24
     * @return string
25
     */
26
    public function render($engine = 'jquery')
27
    {
28
        $chartJS = "";
29
        $chartJS .= $this->renderEngine($engine);
30
        $chartJS .= $this->renderOptions();
31
        $chartJS .= "\n    var " . (isset($this->chart->renderTo) ? $this->chart->renderTo : 'chart') . " = new Highcharts.Map({\n";
32
33
        // Chart Option
34
        $chartJS .= $this->renderWithJavascriptCallback($this->chart->chart, "chart");
35
36
        // Colors
37
        $chartJS .= $this->renderColors();
38
39
        // Color Axis
40
        $chartJS .= $this->renderColorAxis();
41
42
        // Credits
43
        $chartJS .= $this->renderCredits();
44
45
        // Exporting
46
        $chartJS .= $this->renderWithJavascriptCallback($this->exporting->exporting, "exporting");
47
48
        // Labels
49
50
        // Legend
51
        $chartJS .= $this->renderWithJavascriptCallback($this->legend->legend, "legend");
52
53
        // MapNavigation
54
        $chartJS .= $this->renderWithJavascriptCallback($this->mapNavigation->mapNavigation, "mapNavigation");
55
56
        // Loading
57
        // Navigation
58
59
        // PlotOptions
60
        $chartJS .= $this->renderWithJavascriptCallback($this->plotOptions->plotOptions, "plotOptions");
61
62
        // RangeSelector
63
        $chartJS .= $this->renderWithJavascriptCallback($this->rangeSelector->rangeSelector, "rangeSelector");
64
65
        // Scrollbar
66
        $chartJS .= $this->renderScrollbar();
67
68
        // Series
69
        $chartJS .= $this->renderWithJavascriptCallback($this->series, "series");
70
71
        // Subtitle
72
        $chartJS .= $this->renderSubtitle();
73
74
        // Title
75
        $chartJS .= $this->renderTitle();
76
77
        // Tooltip
78
        $chartJS .= $this->renderWithJavascriptCallback($this->tooltip->tooltip, "tooltip");
79
80
        // xAxis
81
        $chartJS .= $this->renderXAxis();
82
83
        // yAxis
84
        $chartJS .= $this->renderYAxis();
85
86
        // trim last trailing comma and close parenthesis
87
        $chartJS = rtrim($chartJS, ",\n") . "\n    });\n";
88
89
        if ($engine !== false) {
90
            $chartJS .= "});\n";
91
        }
92
93
        return trim($chartJS);
94
    }
95
96
    /**
97
     * @return string
98
     */
99
    private function renderColorAxis()
100
    {
101
        if (gettype($this->colorAxis) === 'array') {
102
            return $this->renderWithJavascriptCallback($this->colorAxis, "colorAxis");
103
        } elseif (gettype($this->colorAxis) === 'object') {
104
            return $this->renderWithJavascriptCallback($this->colorAxis->colorAxis, "colorAxis");
105
        }
106
107
        return "";
108
    }
109
}