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
Push — master ( bb8806...1a2c53 )
by Marc
10s
created

Highchart::render()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 74
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 27
CRAP Score 3

Importance

Changes 24
Bugs 7 Features 10
Metric Value
c 24
b 7
f 10
dl 0
loc 74
ccs 27
cts 27
cp 1
rs 9.0335
cc 3
eloc 26
nc 4
nop 1
crap 3

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
 * @method Highchart colors(array $colors)
10
 * @method Highchart series(array $series)
11
 */
12
class Highchart extends AbstractChart implements ChartInterface
13
{
14
    public $colorAxis;
15
16
    public $noData;
17
18 33
    public function __construct()
19
    {
20 33
        parent::__construct();
21 33
        $this->initChartOption('colorAxis');
22 33
        $this->initChartOption('noData');
23 33
    }
24
25
    /**
26
     * @param string $engine
27
     *
28
     * @return string
29
     */
30 32
    public function render($engine = 'jquery')
31
    {
32 32
        $chartJS = "";
33 32
        $chartJS .= $this->renderEngine($engine);
34 32
        $chartJS .= $this->renderOptions();
35 32
        $chartJS .= "\n    var " . (isset($this->chart->renderTo) ? $this->chart->renderTo : 'chart') . " = new Highcharts.Chart({\n";
36
37
        // Chart
38 32
        $chartJS .= $this->renderWithJavascriptCallback($this->chart->chart, "chart");
39
40
        // Colors
41 32
        $chartJS .= $this->renderColors();
42
43
        // Color Axis
44 32
        $chartJS .= $this->renderColorAxis();
45
46
        // Credits
47 32
        $chartJS .= $this->renderCredits();
48
49
        // Exporting
50 32
        $chartJS .= $this->renderWithJavascriptCallback($this->exporting->exporting, "exporting");
51
52
        // Labels
53
54
        // Legend
55 32
        $chartJS .= $this->renderWithJavascriptCallback($this->legend->legend, "legend");
56
57
        // Loading
58
        // Navigation
59
60
        // noData
61 32
        $chartJS .= $this->renderWithJavascriptCallback($this->noData->noData, "noData");
62
63
        // Pane
64 32
        $chartJS .= $this->renderPane();
65
66
        // PlotOptions
67 32
        $chartJS .= $this->renderWithJavascriptCallback($this->plotOptions->plotOptions, "plotOptions");
68
69
        // Series
70 32
        $chartJS .= $this->renderWithJavascriptCallback($this->series, "series");
71
72
        // Scrollbar
73 32
        $chartJS .= $this->renderScrollbar();
74
75
        // Drilldown
76 32
        $chartJS .= $this->renderDrilldown();
77
78
        // Subtitle
79 32
        $chartJS .= $this->renderSubtitle();
80
81
        // Symbols
82
83
        // Title
84 32
        $chartJS .= $this->renderTitle();
85
86
        // Tooltip
87 32
        $chartJS .= $this->renderWithJavascriptCallback($this->tooltip->tooltip, "tooltip");
88
89
        // xAxis
90 32
        $chartJS .= $this->renderXAxis();
91
92
        // yAxis
93 32
        $chartJS .= $this->renderYAxis();
94
95
        // trim last trailing comma and close parenthesis
96 32
        $chartJS = rtrim($chartJS, ",\n") . "\n    });\n";
97
98 32
        if ($engine !== false) {
99 32
            $chartJS .= "});\n";
100 32
        }
101
102 32
        return trim($chartJS);
103
    }
104
105
    /**
106
     * @return string
107
     */
108 32
    private function renderColorAxis()
109
    {
110 32
        if (gettype($this->colorAxis) === 'array') {
111
            return $this->renderWithJavascriptCallback($this->colorAxis, "colorAxis");
112 32
        } elseif (gettype($this->colorAxis) === 'object') {
113 32
            return $this->renderWithJavascriptCallback($this->colorAxis->colorAxis, "colorAxis");
114
        }
115
116
        return "";
117
    }
118
119
    /**
120
     * @return string
121
     */
122 32
    private function renderPane()
123
    {
124 32
        if (get_object_vars($this->pane->pane)) {
125 3
            return "pane: " . json_encode($this->pane->pane) . ",\n";
126
        }
127
128 29
        return "";
129
    }
130
131
    /**
132
     * @return string
133
     */
134 32
    private function renderDrilldown()
135
    {
136 32
        if (get_object_vars($this->drilldown->drilldown)) {
137
            return "drilldown: " . json_encode($this->drilldown->drilldown) . ",\n";
138
        }
139
140 32
        return "";
141
    }
142
}
143