Conditions | 6 |
Paths | 4 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
22 | 17 | public static function create(array $orders, $cursor, Limit $limit, Direction $direction, $exclusive, $seekable) |
|
23 | { |
||
24 | 17 | $cursor = $cursor instanceof Cursor ? $cursor : new ArrayCursor($cursor); |
|
25 | 17 | $mainQuery = new Select( |
|
26 | 17 | $cursor->has() ? ConditionGroup::createMany($orders, $cursor, $direction, $exclusive) : [], |
|
27 | 17 | $direction->backward() |
|
28 | 6 | ? array_map(static function (Order $order) { |
|
29 | 6 | return $order->inverse(); |
|
30 | 6 | }, $orders) |
|
31 | 17 | : $orders, |
|
32 | $limit |
||
33 | ); |
||
34 | |||
35 | 17 | if (!$cursor->has() || !$seekable) { |
|
|
|||
36 | // We don't need UNION ALL and support query when cursor parameters are empty, |
||
37 | // or it does not need to be seekable. |
||
38 | 7 | return $mainQuery; |
|
39 | } |
||
40 | |||
41 | 10 | return new UnionAll($mainQuery); |
|
42 | } |
||
43 | } |
||
44 |
If an expression can have both
false
, andnull
as possible values. It is generally a good practice to always use strict comparison to clearly distinguish between those two values.