1 | <?php |
||
15 | class ComplexSorter implements DirectionalSorterInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var int |
||
19 | */ |
||
20 | private $direction = self::ASC; |
||
21 | |||
22 | /** |
||
23 | * @var SorterInterface |
||
24 | */ |
||
25 | private $ascSorter = null; |
||
26 | |||
27 | /** |
||
28 | * @var SorterInterface |
||
29 | */ |
||
30 | private $descSorter = null; |
||
31 | |||
32 | /** |
||
33 | * @param SorterInterface $ascSorter |
||
34 | * @param SorterInterface $descSorter |
||
35 | */ |
||
36 | public function __construct(SorterInterface $ascSorter, SorterInterface $descSorter) |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function apply($selector) |
||
53 | |||
54 | /** |
||
55 | * Get sorter direction if any |
||
56 | * |
||
57 | * @return int |
||
58 | */ |
||
59 | public function getDirection() |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | public function withDirection($direction) |
||
78 | } |