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.

Highstock::render()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 63
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 3

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 63
ccs 24
cts 24
cp 1
rs 9.4347
cc 3
eloc 23
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 Highstock colors(array $colors)
10
 * @method Highstock series(array $series)
11
 */
12
class Highstock extends AbstractChart implements ChartInterface
13
{
14
    /**
15
     * @param string $engine
16
     *
17
     * @return string
18
     */
19 35
    public function render($engine = 'jquery')
20
    {
21 35
        $chartJS = "";
22 35
        $chartJS .= $this->renderEngine($engine);
23 35
        $chartJS .= $this->renderOptions();
24 35
        $chartJS .= "\n    var " . (isset($this->chart->renderTo) ? $this->chart->renderTo : 'chart') . " = new Highcharts.StockChart({\n";
25
26
        // Chart Option
27 35
        $chartJS .= $this->renderWithJavascriptCallback($this->chart->chart, "chart");
28
29
        // Colors
30 35
        $chartJS .= $this->renderColors();
31
32
        // Credits
33 35
        $chartJS .= $this->renderCredits();
34
35
        // Exporting
36 35
        $chartJS .= $this->renderWithJavascriptCallback($this->exporting->exporting, "exporting");
37
38
        // Labels
39
40
        // Legend
41 35
        $chartJS .= $this->renderWithJavascriptCallback($this->legend->legend, "legend");
42
43
        // Loading
44
        // Navigation
45
46
        // PlotOptions
47 35
        $chartJS .= $this->renderWithJavascriptCallback($this->plotOptions->plotOptions, "plotOptions");
48
49
        // RangeSelector
50 35
        $chartJS .= $this->renderWithJavascriptCallback($this->rangeSelector->rangeSelector, "rangeSelector");
51
52
        // Scrollbar
53 35
        $chartJS .= $this->renderScrollbar();
54
55
        // Series
56 35
        $chartJS .= $this->renderWithJavascriptCallback($this->series, "series");
57
58
        // Subtitle
59 35
        $chartJS .= $this->renderSubtitle();
60
61
        // Title
62 35
        $chartJS .= $this->renderTitle();
63
64
        // Tooltip
65 35
        $chartJS .= $this->renderWithJavascriptCallback($this->tooltip->tooltip, "tooltip");
66
67
        // xAxis
68 35
        $chartJS .= $this->renderXAxis();
69
70
        // yAxis
71 35
        $chartJS .= $this->renderYAxis();
72
73
        // trim last trailing comma and close parenthesis
74 35
        $chartJS = rtrim($chartJS, ",\n") . "\n    });\n";
75
76 35
        if ($engine !== false) {
77 35
            $chartJS .= "});\n";
78 35
        }
79
80 35
        return trim($chartJS);
81
    }
82
}
83