Conditions | 4 |
Paths | 8 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.0218 |
Changes | 0 |
1 | <?php |
||
20 | 1 | public function sort($label, $column, $selectedSortKey, $selectedSortOrder, array $additionalParameters = null) |
|
21 | { |
||
22 | 1 | if ($additionalParameters === null) { |
|
23 | $additionalParameters = []; |
||
24 | } |
||
25 | |||
26 | 1 | $orders = ['desc' => 'asc', 'asc' => 'desc']; |
|
27 | 1 | if (!in_array($selectedSortOrder, $orders)) { |
|
28 | 1 | $selectedSortOrder = reset($orders); |
|
29 | } |
||
30 | |||
31 | 1 | $url = $this->view->urlParams(array_merge($additionalParameters, ['sort' => $column, 'sortOrder' => $orders[$selectedSortOrder]])); |
|
32 | 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>'; |
|
33 | |||
34 | 1 | return $result; |
|
35 | } |
||
37 |