1 | <?php |
||
13 | abstract class AbstractSortStrategy implements StrategyInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var int |
||
17 | */ |
||
18 | private $sortOrder = null; |
||
19 | |||
20 | /** |
||
21 | * @var bool |
||
22 | */ |
||
23 | private $maintainKeyAssociation = false; |
||
24 | |||
25 | /** |
||
26 | * @var ComparatorInterface |
||
27 | */ |
||
28 | private $comparator; |
||
29 | |||
30 | /** |
||
31 | * @param int $sortOrder Default sort order |
||
32 | * @param ComparatorInterface $comparator Default comparator |
||
33 | */ |
||
34 | 7 | function __construct(ComparatorInterface $comparator = null, $sortOrder = self::ASC) |
|
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | 7 | public function setComparator(ComparatorInterface $comparator) |
|
58 | |||
59 | /** |
||
60 | * @return ComparatorInterface |
||
61 | */ |
||
62 | 4 | protected function getComparator() |
|
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 7 | public function setSortOrder($order) |
|
76 | |||
77 | /** |
||
78 | * @return int |
||
79 | */ |
||
80 | 1 | protected function getSortOrder() |
|
84 | |||
85 | /** |
||
86 | * {@inheritdoc} |
||
87 | */ |
||
88 | 1 | public function setMaintainKeyAssociation($maintainKeyAssociation) |
|
92 | |||
93 | /** |
||
94 | * @return \Closure |
||
95 | */ |
||
96 | 3 | protected function createSortTransformFunction() |
|
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | 4 | public function sort(array $collection) |
|
120 | |||
121 | /** |
||
122 | * Returns a closure that validates values before passing them to the ComparatorInterface |
||
123 | * |
||
124 | * @return \Closure |
||
125 | */ |
||
126 | protected function getValueChecker() |
||
144 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.