| 1 | <?php |
||
| 13 | abstract class AbstractSorter implements SorterInterface |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var StrategyInterface |
||
| 17 | */ |
||
| 18 | private $strategy; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Create new sorter with given strategy |
||
| 22 | * If no strategy given, default StringArraySortStrategy will be used |
||
| 23 | * |
||
| 24 | * @see SimpleSortStrategy |
||
| 25 | * @see ComplexSortStrategy |
||
| 26 | * |
||
| 27 | * @param StrategyInterface $strategy |
||
| 28 | */ |
||
| 29 | 6 | function __construct(StrategyInterface $strategy = null) |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @param StrategyInterface $strategy |
||
| 40 | * |
||
| 41 | * @return $this |
||
| 42 | */ |
||
| 43 | 6 | public function setStrategy($strategy) |
|
| 49 | |||
| 50 | /** |
||
| 51 | * Set sort order |
||
| 52 | * |
||
| 53 | * @param int $order |
||
| 54 | * |
||
| 55 | * @return $this |
||
| 56 | */ |
||
| 57 | 1 | public function setSortOrder($order) |
|
| 63 | |||
| 64 | /** |
||
| 65 | * {@inheritdoc} |
||
| 66 | */ |
||
| 67 | 3 | public function sort(array $collection) |
|
| 75 | } |
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.