1 | <?php |
||
7 | class ListSorter extends AbstractListSorter |
||
8 | { |
||
9 | const DEFAULT_SORT_BY_KEY = 'by'; |
||
10 | const DEFAULT_SORT_DIR_KEY = 'dir'; |
||
11 | |||
12 | private $sortByKey; |
||
13 | private $sortDirKey; |
||
14 | private $defaultSortBy; |
||
15 | private $defaultSortDir; |
||
16 | |||
17 | /** |
||
18 | * @return string |
||
19 | */ |
||
20 | 6 | public function getSortByKey() |
|
28 | |||
29 | /** |
||
30 | * @param string $sortByKey |
||
31 | */ |
||
32 | 1 | public function setSortByKey($sortByKey) |
|
36 | |||
37 | /** |
||
38 | * @return string |
||
39 | */ |
||
40 | 4 | public function getSortDirKey() |
|
48 | |||
49 | /** |
||
50 | * @param string $sortDirKey |
||
51 | */ |
||
52 | 1 | public function setSortDirKey($sortDirKey) |
|
56 | |||
57 | /** |
||
58 | * @param $key |
||
59 | * |
||
60 | * @return bool|SortableItem |
||
61 | */ |
||
62 | 6 | private function findSortableItem($key) |
|
72 | |||
73 | /** |
||
74 | * @return bool|SortableItem|void |
||
75 | */ |
||
76 | 5 | public function getSelectedSortableItem() |
|
95 | |||
96 | /** |
||
97 | * @return string |
||
98 | */ |
||
99 | 4 | public function getDefaultSortBy() |
|
103 | |||
104 | /** |
||
105 | * @param $key |
||
106 | * |
||
107 | * @throws \Exception |
||
108 | */ |
||
109 | 2 | public function setDefaultSortBy($key) |
|
117 | |||
118 | /** |
||
119 | * @param $dir |
||
120 | */ |
||
121 | 2 | public function setDefaultSortDir($dir) |
|
125 | |||
126 | /** |
||
127 | * @return string |
||
128 | */ |
||
129 | 2 | public function getDefaultSortDir() |
|
133 | |||
134 | /** |
||
135 | * @return string|void |
||
136 | */ |
||
137 | 2 | public function getSortBy() |
|
146 | |||
147 | /** |
||
148 | * @return string|void |
||
149 | */ |
||
150 | 2 | public function getSortDir() |
|
165 | } |
||
166 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.