| Conditions | 2 |
| Paths | 2 |
| Total Lines | 34 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2.003 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 1 | public function graph(\mQueue\Model\User $user = null) |
|
| 16 | { |
||
| 17 | 1 | $params = ['controller' => 'status', 'action' => 'graph']; |
|
| 18 | 1 | if ($user) { |
|
| 19 | $params['user'] = $user->id; |
||
| 20 | } |
||
| 21 | 1 | $url = $this->view->serverUrl() . $this->view->url($params, 'default'); |
|
| 22 | |||
| 23 | $js = <<<STRING |
||
| 24 | $(document).ready(function() { |
||
| 25 | var refreshGraph = function() { |
||
| 26 | var percentage = $('#graph_percent').is(':checked') ? '?percent=1' : ''; |
||
| 27 | 1 | $.get('$url' + percentage, function (chart) { |
|
| 28 | chart = $.parseJSON(chart); |
||
| 29 | $('#chart_container').highcharts(chart); |
||
| 30 | }); |
||
| 31 | }; |
||
| 32 | |||
| 33 | $('#graph_percent').change(refreshGraph); |
||
| 34 | refreshGraph(); |
||
| 35 | |||
| 36 | }); |
||
| 37 | STRING; |
||
| 38 | |||
| 39 | 1 | $html = '<div id="chart_container" style="min-height: 400px"></div> |
|
| 40 | <input type="checkbox" name="graph_percent" id="graph_percent" value="1"> |
||
| 41 | <label for="graph_percent">Show graph as stacked percentage</label>'; |
||
| 42 | |||
| 43 | 1 | $this->view->headScript() |
|
| 44 | 1 | ->appendFile('/js/min/highcharts.js') |
|
| 45 | 1 | ->appendScript($js); |
|
| 46 | |||
| 47 | 1 | return $html; |
|
| 48 | } |
||
| 49 | } |
||
| 50 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.