| Conditions | 4 |
| Paths | 8 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.0218 |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 18 | 1 | public function sort($label, $column, $selectedSortKey, $selectedSortOrder, array $additionalParameters = null) |
|
| 19 | { |
||
| 20 | 1 | if (is_null($additionalParameters)) { |
|
| 21 | $additionalParameters = []; |
||
| 22 | } |
||
| 23 | |||
| 24 | 1 | $orders = ['desc' => 'asc', 'asc' => 'desc']; |
|
| 25 | 1 | if (!in_array($selectedSortOrder, $orders)) { |
|
| 26 | 1 | $selectedSortOrder = reset($orders); |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | $url = $this->view->urlParams(array_merge($additionalParameters, ['sort' => $column, 'sortOrder' => $orders[$selectedSortOrder]])); |
|
|
1 ignored issue
–
show
|
|||
| 30 | 1 | $result = '<a class="sort ' . ($column == $selectedSortKey ? $selectedSortOrder : '') . '" title="' . $this->view->escape($this->view->translate('Sort by "%s"', [$label])) . '" href="' . $url . '">' . $this->view->escape($label) . '</a>'; |
|
|
1 ignored issue
–
show
|
|||
| 31 | |||
| 32 | 1 | return $result; |
|
| 33 | } |
||
| 34 | } |
||
| 35 |
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. In addition it looks for parameters that have the generic type
arrayand suggests a stricter type likearray<String>.Most often this is a case of a parameter that can be null in addition to its declared types.