| Conditions | 1 |
| Total Lines | 643 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 821 | public static function queryExpressionProvider(): Generator |
||
| 822 | { |
||
| 823 | yield 'Ascending forward start inclusive with QueryExpression' => [ |
||
| 824 | function () { |
||
| 825 | return [ |
||
| 826 | 'forward' => true, |
||
| 827 | 'seekable' => true, |
||
| 828 | 'limit' => 3, |
||
| 829 | 'order' => [ |
||
| 830 | new OrderClauseExpression('modified', 'asc'), |
||
| 831 | new OrderClauseExpression('id', 'asc'), |
||
| 832 | ], |
||
| 833 | ]; |
||
| 834 | }, |
||
| 835 | new PaginationResult( |
||
| 836 | [ |
||
| 837 | new Entity([ |
||
| 838 | 'id' => 1, |
||
| 839 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 840 | ]), |
||
| 841 | new Entity([ |
||
| 842 | 'id' => 3, |
||
| 843 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 844 | ]), |
||
| 845 | new Entity([ |
||
| 846 | 'id' => 5, |
||
| 847 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 848 | ]), |
||
| 849 | ], |
||
| 850 | [ |
||
| 851 | 'hasPrevious' => null, |
||
| 852 | 'previousCursor' => null, |
||
| 853 | 'hasNext' => true, |
||
| 854 | 'nextCursor' => [ |
||
| 855 | 'id' => 2, |
||
| 856 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 857 | ], |
||
| 858 | ] |
||
| 859 | ), |
||
| 860 | ]; |
||
| 861 | |||
| 862 | yield 'Ascending forward start exclusive with QueryExpression' => [ |
||
| 863 | function () { |
||
| 864 | return [ |
||
| 865 | 'forward' => true, |
||
| 866 | 'seekable' => true, |
||
| 867 | 'exclusive' => true, |
||
| 868 | 'limit' => 3, |
||
| 869 | 'order' => [ |
||
| 870 | new OrderClauseExpression('modified', 'asc'), |
||
| 871 | new OrderClauseExpression('id', 'asc'), |
||
| 872 | ], |
||
| 873 | ]; |
||
| 874 | }, |
||
| 875 | new PaginationResult( |
||
| 876 | [ |
||
| 877 | new Entity([ |
||
| 878 | 'id' => 1, |
||
| 879 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 880 | ]), |
||
| 881 | new Entity([ |
||
| 882 | 'id' => 3, |
||
| 883 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 884 | ]), |
||
| 885 | new Entity([ |
||
| 886 | 'id' => 5, |
||
| 887 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 888 | ]), |
||
| 889 | ], |
||
| 890 | [ |
||
| 891 | 'hasPrevious' => null, |
||
| 892 | 'previousCursor' => null, |
||
| 893 | 'hasNext' => true, |
||
| 894 | 'nextCursor' => [ |
||
| 895 | 'id' => 5, |
||
| 896 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 897 | ], |
||
| 898 | ] |
||
| 899 | ), |
||
| 900 | ]; |
||
| 901 | |||
| 902 | yield 'Ascending forward inclusive with QueryExpression' => [ |
||
| 903 | function () { |
||
| 904 | return [ |
||
| 905 | 'forward' => true, |
||
| 906 | 'seekable' => true, |
||
| 907 | 'limit' => 3, |
||
| 908 | 'order' => [ |
||
| 909 | new OrderClauseExpression('modified', 'asc'), |
||
| 910 | new OrderClauseExpression('id', 'asc'), |
||
| 911 | ], |
||
| 912 | 'cursor' => [ |
||
| 913 | 'id' => 3, |
||
| 914 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 915 | ], |
||
| 916 | ]; |
||
| 917 | }, |
||
| 918 | new PaginationResult( |
||
| 919 | [ |
||
| 920 | new Entity([ |
||
| 921 | 'id' => 3, |
||
| 922 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 923 | ]), |
||
| 924 | new Entity([ |
||
| 925 | 'id' => 5, |
||
| 926 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 927 | ]), |
||
| 928 | new Entity([ |
||
| 929 | 'id' => 2, |
||
| 930 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 931 | ]), |
||
| 932 | ], |
||
| 933 | [ |
||
| 934 | 'hasPrevious' => true, |
||
| 935 | 'previousCursor' => [ |
||
| 936 | 'id' => 1, |
||
| 937 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 938 | ], |
||
| 939 | 'hasNext' => true, |
||
| 940 | 'nextCursor' => [ |
||
| 941 | 'id' => 4, |
||
| 942 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 943 | ], |
||
| 944 | ] |
||
| 945 | ), |
||
| 946 | ]; |
||
| 947 | |||
| 948 | yield 'Ascending forward exclusive with QueryExpression' => [ |
||
| 949 | function () { |
||
| 950 | return [ |
||
| 951 | 'forward' => true, |
||
| 952 | 'seekable' => true, |
||
| 953 | 'exclusive' => true, |
||
| 954 | 'limit' => 3, |
||
| 955 | 'order' => [ |
||
| 956 | new OrderClauseExpression('modified', 'asc'), |
||
| 957 | new OrderClauseExpression('id', 'asc'), |
||
| 958 | ], |
||
| 959 | 'cursor' => [ |
||
| 960 | 'id' => 3, |
||
| 961 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 962 | ], |
||
| 963 | ]; |
||
| 964 | }, |
||
| 965 | new PaginationResult( |
||
| 966 | [ |
||
| 967 | new Entity([ |
||
| 968 | 'id' => 5, |
||
| 969 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 970 | ]), |
||
| 971 | new Entity([ |
||
| 972 | 'id' => 2, |
||
| 973 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 974 | ]), |
||
| 975 | new Entity([ |
||
| 976 | 'id' => 4, |
||
| 977 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 978 | ]), |
||
| 979 | ], |
||
| 980 | [ |
||
| 981 | 'hasPrevious' => true, |
||
| 982 | 'previousCursor' => [ |
||
| 983 | 'id' => 5, |
||
| 984 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 985 | ], |
||
| 986 | 'hasNext' => false, |
||
| 987 | 'nextCursor' => null, |
||
| 988 | ] |
||
| 989 | ), |
||
| 990 | ]; |
||
| 991 | |||
| 992 | yield 'Ascending backward start inclusive with QueryExpression' => [ |
||
| 993 | function () { |
||
| 994 | return [ |
||
| 995 | 'backward' => true, |
||
| 996 | 'seekable' => true, |
||
| 997 | 'limit' => 3, |
||
| 998 | 'order' => [ |
||
| 999 | new OrderClauseExpression('modified', 'asc'), |
||
| 1000 | new OrderClauseExpression('id', 'asc'), |
||
| 1001 | ], |
||
| 1002 | ]; |
||
| 1003 | }, |
||
| 1004 | new PaginationResult( |
||
| 1005 | [ |
||
| 1006 | new Entity([ |
||
| 1007 | 'id' => 5, |
||
| 1008 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1009 | ]), |
||
| 1010 | new Entity([ |
||
| 1011 | 'id' => 2, |
||
| 1012 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1013 | ]), |
||
| 1014 | new Entity([ |
||
| 1015 | 'id' => 4, |
||
| 1016 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1017 | ]), |
||
| 1018 | ], |
||
| 1019 | [ |
||
| 1020 | 'hasPrevious' => true, |
||
| 1021 | 'previousCursor' => [ |
||
| 1022 | 'id' => 3, |
||
| 1023 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1024 | ], |
||
| 1025 | 'hasNext' => null, |
||
| 1026 | 'nextCursor' => null, |
||
| 1027 | ] |
||
| 1028 | ), |
||
| 1029 | ]; |
||
| 1030 | |||
| 1031 | yield 'Ascending backward start exclusive with QueryExpression' => [ |
||
| 1032 | function () { |
||
| 1033 | return [ |
||
| 1034 | 'backward' => true, |
||
| 1035 | 'seekable' => true, |
||
| 1036 | 'exclusive' => true, |
||
| 1037 | 'limit' => 3, |
||
| 1038 | 'order' => [ |
||
| 1039 | new OrderClauseExpression('modified', 'asc'), |
||
| 1040 | new OrderClauseExpression('id', 'asc'), |
||
| 1041 | ], |
||
| 1042 | ]; |
||
| 1043 | }, |
||
| 1044 | new PaginationResult( |
||
| 1045 | [ |
||
| 1046 | new Entity([ |
||
| 1047 | 'id' => 5, |
||
| 1048 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1049 | ]), |
||
| 1050 | new Entity([ |
||
| 1051 | 'id' => 2, |
||
| 1052 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1053 | ]), |
||
| 1054 | new Entity([ |
||
| 1055 | 'id' => 4, |
||
| 1056 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1057 | ]), |
||
| 1058 | ], |
||
| 1059 | [ |
||
| 1060 | 'hasPrevious' => true, |
||
| 1061 | 'previousCursor' => [ |
||
| 1062 | 'id' => 5, |
||
| 1063 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1064 | ], |
||
| 1065 | 'hasNext' => null, |
||
| 1066 | 'nextCursor' => null, |
||
| 1067 | ] |
||
| 1068 | ), |
||
| 1069 | ]; |
||
| 1070 | |||
| 1071 | yield 'Ascending backward inclusive with QueryExpression' => [ |
||
| 1072 | function () { |
||
| 1073 | return [ |
||
| 1074 | 'backward' => true, |
||
| 1075 | 'seekable' => true, |
||
| 1076 | 'limit' => 3, |
||
| 1077 | 'order' => [ |
||
| 1078 | new OrderClauseExpression('modified', 'asc'), |
||
| 1079 | new OrderClauseExpression('id', 'asc'), |
||
| 1080 | ], |
||
| 1081 | 'cursor' => [ |
||
| 1082 | 'id' => 3, |
||
| 1083 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1084 | ], |
||
| 1085 | ]; |
||
| 1086 | }, |
||
| 1087 | new PaginationResult( |
||
| 1088 | [ |
||
| 1089 | new Entity([ |
||
| 1090 | 'id' => 1, |
||
| 1091 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1092 | ]), |
||
| 1093 | new Entity([ |
||
| 1094 | 'id' => 3, |
||
| 1095 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1096 | ]), |
||
| 1097 | ], |
||
| 1098 | [ |
||
| 1099 | 'hasPrevious' => false, |
||
| 1100 | 'previousCursor' => null, |
||
| 1101 | 'hasNext' => true, |
||
| 1102 | 'nextCursor' => [ |
||
| 1103 | 'id' => 5, |
||
| 1104 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1105 | ], |
||
| 1106 | ] |
||
| 1107 | ), |
||
| 1108 | ]; |
||
| 1109 | |||
| 1110 | yield 'Ascending backward exclusive with QueryExpression' => [ |
||
| 1111 | function () { |
||
| 1112 | return [ |
||
| 1113 | 'backward' => true, |
||
| 1114 | 'seekable' => true, |
||
| 1115 | 'exclusive' => true, |
||
| 1116 | 'limit' => 3, |
||
| 1117 | 'order' => [ |
||
| 1118 | new OrderClauseExpression('modified', 'asc'), |
||
| 1119 | new OrderClauseExpression('id', 'asc'), |
||
| 1120 | ], |
||
| 1121 | 'cursor' => [ |
||
| 1122 | 'id' => 3, |
||
| 1123 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1124 | ], |
||
| 1125 | ]; |
||
| 1126 | }, |
||
| 1127 | new PaginationResult( |
||
| 1128 | [ |
||
| 1129 | new Entity([ |
||
| 1130 | 'id' => 1, |
||
| 1131 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1132 | ]), |
||
| 1133 | ], |
||
| 1134 | [ |
||
| 1135 | 'hasPrevious' => false, |
||
| 1136 | 'previousCursor' => null, |
||
| 1137 | 'hasNext' => true, |
||
| 1138 | 'nextCursor' => [ |
||
| 1139 | 'id' => 1, |
||
| 1140 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1141 | ], |
||
| 1142 | ] |
||
| 1143 | ), |
||
| 1144 | ]; |
||
| 1145 | |||
| 1146 | yield 'Descending forward start inclusive with QueryExpression' => [ |
||
| 1147 | function () { |
||
| 1148 | return [ |
||
| 1149 | 'forward' => true, |
||
| 1150 | 'seekable' => true, |
||
| 1151 | 'limit' => 3, |
||
| 1152 | 'order' => [ |
||
| 1153 | new OrderClauseExpression('modified', 'desc'), |
||
| 1154 | new OrderClauseExpression('id', 'desc'), |
||
| 1155 | ], |
||
| 1156 | ]; |
||
| 1157 | }, |
||
| 1158 | new PaginationResult( |
||
| 1159 | [ |
||
| 1160 | new Entity([ |
||
| 1161 | 'id' => 4, |
||
| 1162 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1163 | ]), |
||
| 1164 | new Entity([ |
||
| 1165 | 'id' => 2, |
||
| 1166 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1167 | ]), |
||
| 1168 | new Entity([ |
||
| 1169 | 'id' => 5, |
||
| 1170 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1171 | ]), |
||
| 1172 | ], |
||
| 1173 | [ |
||
| 1174 | 'hasPrevious' => null, |
||
| 1175 | 'previousCursor' => null, |
||
| 1176 | 'hasNext' => true, |
||
| 1177 | 'nextCursor' => [ |
||
| 1178 | 'id' => 3, |
||
| 1179 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1180 | ], |
||
| 1181 | ] |
||
| 1182 | ), |
||
| 1183 | ]; |
||
| 1184 | |||
| 1185 | yield 'Descending forward start exclusive with QueryExpression' => [ |
||
| 1186 | function () { |
||
| 1187 | return [ |
||
| 1188 | 'forward' => true, |
||
| 1189 | 'seekable' => true, |
||
| 1190 | 'exclusive' => true, |
||
| 1191 | 'limit' => 3, |
||
| 1192 | 'order' => [ |
||
| 1193 | new OrderClauseExpression('modified', 'desc'), |
||
| 1194 | new OrderClauseExpression('id', 'desc'), |
||
| 1195 | ], |
||
| 1196 | ]; |
||
| 1197 | }, |
||
| 1198 | new PaginationResult( |
||
| 1199 | [ |
||
| 1200 | new Entity([ |
||
| 1201 | 'id' => 4, |
||
| 1202 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1203 | ]), |
||
| 1204 | new Entity([ |
||
| 1205 | 'id' => 2, |
||
| 1206 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1207 | ]), |
||
| 1208 | new Entity([ |
||
| 1209 | 'id' => 5, |
||
| 1210 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1211 | ]), |
||
| 1212 | ], |
||
| 1213 | [ |
||
| 1214 | 'hasPrevious' => null, |
||
| 1215 | 'previousCursor' => null, |
||
| 1216 | 'hasNext' => true, |
||
| 1217 | 'nextCursor' => [ |
||
| 1218 | 'id' => 5, |
||
| 1219 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1220 | ], |
||
| 1221 | ] |
||
| 1222 | ), |
||
| 1223 | ]; |
||
| 1224 | |||
| 1225 | yield 'Descending forward inclusive with QueryExpression' => [ |
||
| 1226 | function () { |
||
| 1227 | return [ |
||
| 1228 | 'forward' => true, |
||
| 1229 | 'seekable' => true, |
||
| 1230 | 'limit' => 3, |
||
| 1231 | 'order' => [ |
||
| 1232 | new OrderClauseExpression('modified', 'desc'), |
||
| 1233 | new OrderClauseExpression('id', 'desc'), |
||
| 1234 | ], |
||
| 1235 | 'cursor' => [ |
||
| 1236 | 'id' => 3, |
||
| 1237 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1238 | ], |
||
| 1239 | ]; |
||
| 1240 | }, |
||
| 1241 | new PaginationResult( |
||
| 1242 | [ |
||
| 1243 | new Entity([ |
||
| 1244 | 'id' => 3, |
||
| 1245 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1246 | ]), |
||
| 1247 | new Entity([ |
||
| 1248 | 'id' => 1, |
||
| 1249 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1250 | ]), |
||
| 1251 | ], |
||
| 1252 | [ |
||
| 1253 | 'hasPrevious' => true, |
||
| 1254 | 'previousCursor' => [ |
||
| 1255 | 'id' => 5, |
||
| 1256 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1257 | ], |
||
| 1258 | 'hasNext' => false, |
||
| 1259 | 'nextCursor' => null, |
||
| 1260 | ] |
||
| 1261 | ), |
||
| 1262 | ]; |
||
| 1263 | |||
| 1264 | yield 'Descending forward exclusive with QueryExpression' => [ |
||
| 1265 | function () { |
||
| 1266 | return [ |
||
| 1267 | 'forward' => true, |
||
| 1268 | 'seekable' => true, |
||
| 1269 | 'exclusive' => true, |
||
| 1270 | 'limit' => 3, |
||
| 1271 | 'order' => [ |
||
| 1272 | new OrderClauseExpression('modified', 'desc'), |
||
| 1273 | new OrderClauseExpression('id', 'desc'), |
||
| 1274 | ], |
||
| 1275 | 'cursor' => [ |
||
| 1276 | 'id' => 3, |
||
| 1277 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1278 | ], |
||
| 1279 | ]; |
||
| 1280 | }, |
||
| 1281 | new PaginationResult( |
||
| 1282 | [ |
||
| 1283 | new Entity([ |
||
| 1284 | 'id' => 1, |
||
| 1285 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1286 | ]), |
||
| 1287 | ], |
||
| 1288 | [ |
||
| 1289 | 'hasPrevious' => true, |
||
| 1290 | 'previousCursor' => [ |
||
| 1291 | 'id' => 1, |
||
| 1292 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1293 | ], |
||
| 1294 | 'hasNext' => false, |
||
| 1295 | 'nextCursor' => null, |
||
| 1296 | ] |
||
| 1297 | ), |
||
| 1298 | ]; |
||
| 1299 | |||
| 1300 | yield 'Descending backward start inclusive with QueryExpression' => [ |
||
| 1301 | function () { |
||
| 1302 | return [ |
||
| 1303 | 'backward' => true, |
||
| 1304 | 'seekable' => true, |
||
| 1305 | 'limit' => 3, |
||
| 1306 | 'order' => [ |
||
| 1307 | new OrderClauseExpression('modified', 'desc'), |
||
| 1308 | new OrderClauseExpression('id', 'desc'), |
||
| 1309 | ], |
||
| 1310 | ]; |
||
| 1311 | }, |
||
| 1312 | new PaginationResult( |
||
| 1313 | [ |
||
| 1314 | new Entity([ |
||
| 1315 | 'id' => 5, |
||
| 1316 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1317 | ]), |
||
| 1318 | new Entity([ |
||
| 1319 | 'id' => 3, |
||
| 1320 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1321 | ]), |
||
| 1322 | new Entity([ |
||
| 1323 | 'id' => 1, |
||
| 1324 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1325 | ]), |
||
| 1326 | ], |
||
| 1327 | [ |
||
| 1328 | 'hasPrevious' => true, |
||
| 1329 | 'previousCursor' => [ |
||
| 1330 | 'id' => 2, |
||
| 1331 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1332 | ], |
||
| 1333 | 'hasNext' => null, |
||
| 1334 | 'nextCursor' => null, |
||
| 1335 | ] |
||
| 1336 | ), |
||
| 1337 | ]; |
||
| 1338 | |||
| 1339 | yield 'Descending backward start exclusive with QueryExpression' => [ |
||
| 1340 | function () { |
||
| 1341 | return [ |
||
| 1342 | 'backward' => true, |
||
| 1343 | 'seekable' => true, |
||
| 1344 | 'exclusive' => true, |
||
| 1345 | 'limit' => 3, |
||
| 1346 | 'order' => [ |
||
| 1347 | new OrderClauseExpression('modified', 'desc'), |
||
| 1348 | new OrderClauseExpression('id', 'desc'), |
||
| 1349 | ], |
||
| 1350 | ]; |
||
| 1351 | }, |
||
| 1352 | new PaginationResult( |
||
| 1353 | [ |
||
| 1354 | new Entity([ |
||
| 1355 | 'id' => 5, |
||
| 1356 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1357 | ]), |
||
| 1358 | new Entity([ |
||
| 1359 | 'id' => 3, |
||
| 1360 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1361 | ]), |
||
| 1362 | new Entity([ |
||
| 1363 | 'id' => 1, |
||
| 1364 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1365 | ]), |
||
| 1366 | ], |
||
| 1367 | [ |
||
| 1368 | 'hasPrevious' => true, |
||
| 1369 | 'previousCursor' => [ |
||
| 1370 | 'id' => 5, |
||
| 1371 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1372 | ], |
||
| 1373 | 'hasNext' => null, |
||
| 1374 | 'nextCursor' => null, |
||
| 1375 | ] |
||
| 1376 | ), |
||
| 1377 | ]; |
||
| 1378 | |||
| 1379 | yield 'Descending backward inclusive with QueryExpression' => [ |
||
| 1380 | function () { |
||
| 1381 | return [ |
||
| 1382 | 'backward' => true, |
||
| 1383 | 'seekable' => true, |
||
| 1384 | 'limit' => 3, |
||
| 1385 | 'order' => [ |
||
| 1386 | new OrderClauseExpression('modified', 'desc'), |
||
| 1387 | new OrderClauseExpression('id', 'desc'), |
||
| 1388 | ], |
||
| 1389 | 'cursor' => [ |
||
| 1390 | 'id' => 3, |
||
| 1391 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1392 | ], |
||
| 1393 | ]; |
||
| 1394 | }, |
||
| 1395 | new PaginationResult( |
||
| 1396 | [ |
||
| 1397 | new Entity([ |
||
| 1398 | 'id' => 2, |
||
| 1399 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1400 | ]), |
||
| 1401 | new Entity([ |
||
| 1402 | 'id' => 5, |
||
| 1403 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1404 | ]), |
||
| 1405 | new Entity([ |
||
| 1406 | 'id' => 3, |
||
| 1407 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1408 | ]), |
||
| 1409 | ], |
||
| 1410 | [ |
||
| 1411 | 'hasPrevious' => true, |
||
| 1412 | 'previousCursor' => [ |
||
| 1413 | 'id' => 4, |
||
| 1414 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1415 | ], |
||
| 1416 | 'hasNext' => true, |
||
| 1417 | 'nextCursor' => [ |
||
| 1418 | 'id' => 1, |
||
| 1419 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1420 | ], |
||
| 1421 | ] |
||
| 1422 | ), |
||
| 1423 | ]; |
||
| 1424 | |||
| 1425 | yield 'Descending backward exclusive with QueryExpression' => [ |
||
| 1426 | function () { |
||
| 1427 | return [ |
||
| 1428 | 'backward' => true, |
||
| 1429 | 'seekable' => true, |
||
| 1430 | 'exclusive' => true, |
||
| 1431 | 'limit' => 3, |
||
| 1432 | 'order' => [ |
||
| 1433 | new OrderClauseExpression('modified', 'desc'), |
||
| 1434 | new OrderClauseExpression('id', 'desc'), |
||
| 1435 | ], |
||
| 1436 | 'cursor' => [ |
||
| 1437 | 'id' => 3, |
||
| 1438 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1439 | ], |
||
| 1440 | ]; |
||
| 1441 | }, |
||
| 1442 | new PaginationResult( |
||
| 1443 | [ |
||
| 1444 | new Entity([ |
||
| 1445 | 'id' => 4, |
||
| 1446 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1447 | ]), |
||
| 1448 | new Entity([ |
||
| 1449 | 'id' => 2, |
||
| 1450 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1451 | ]), |
||
| 1452 | new Entity([ |
||
| 1453 | 'id' => 5, |
||
| 1454 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1455 | ]), |
||
| 1456 | ], |
||
| 1457 | [ |
||
| 1458 | 'hasPrevious' => false, |
||
| 1459 | 'previousCursor' => null, |
||
| 1460 | 'hasNext' => true, |
||
| 1461 | 'nextCursor' => [ |
||
| 1462 | 'id' => 5, |
||
| 1463 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1464 | ], |
||
| 1470 |