Total Complexity | 6 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php namespace Nord\Lumen\Elasticsearch\Search; |
||
14 | class Sort implements Arrayable |
||
15 | { |
||
16 | /** |
||
17 | * @var AbstractSort[] |
||
18 | */ |
||
19 | private $sorts; |
||
20 | |||
21 | /** |
||
22 | * Sort constructor. |
||
23 | * |
||
24 | * @param AbstractSort[] $sorts |
||
25 | */ |
||
26 | public function __construct(array $sorts = []) |
||
27 | { |
||
28 | $this->sorts = $sorts; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @return array |
||
33 | */ |
||
34 | public function toArray() |
||
35 | { |
||
36 | $result = []; |
||
37 | foreach ($this->getSorts() as $sort) { |
||
38 | $result[] = $sort->toArray(); |
||
39 | } |
||
40 | |||
41 | return $result; |
||
42 | } |
||
43 | |||
44 | |||
45 | /** |
||
46 | * @param AbstractSort $sort |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function addSort(AbstractSort $sort) |
||
53 | } |
||
54 | |||
55 | |||
56 | /** |
||
57 | * @param AbstractSort[] $sorts |
||
58 | * @return Sort |
||
59 | */ |
||
60 | public function setSorts($sorts) |
||
64 | } |
||
65 | |||
66 | |||
67 | /** |
||
68 | * @return AbstractSort[] |
||
69 | */ |
||
70 | public function getSorts() |
||
73 | } |
||
74 | } |
||
75 |