@@ -28,26 +28,42 @@ public function __construct(array $commands, string $path) {
2828
2929 private function parseCommands (array $ commands ) : void {
3030 switch ( $ commands [0 ] ) {
31- case "day " :
32- $ this ->backUntil (time () - 86400 , array_slice ($ commands , 1 ));
31+ case "cDay " :
32+ $ commands = array_slice ($ commands , 1 );
33+ $ this ->todayview = true ;
34+ $ this ->backUntil (strtotime ("today " ), $ commands );
35+ case "cWeek " :
36+ $ this ->backUntil (strtotime ("last Monday " ), array_slice ($ commands , 1 ));
37+ break ;
38+ case "cMonth " :
39+ $ this ->backUntil (strtotime (date ("Y-m " )."-01 " ), array_slice ($ commands , 1 ));
40+ break ;
41+ case "cYear " :
42+ $ this ->backUntil (strtotime (date ("Y " )."-01-01 " ), array_slice ($ commands , 1 ));
43+ break ;
44+
45+ case "lDay " :
46+ $ this ->backUntil (time () - 24 *60 *60 , array_slice ($ commands , 1 ));
3347 break ;
34- case "week " :
35- $ this ->backUntil (time () - 604800 , array_slice ($ commands , 1 ));
48+ case "lWeek " :
49+ $ this ->backUntil (time () - 7 * 24 * 60 * 60 , array_slice ($ commands , 1 ));
3650 break ;
37- case "month " :
38- $ this ->backUntil (time () - 2628000 , array_slice ($ commands , 1 ));
51+ case "lMonth " :
52+ $ this ->backUntil (time () - 30 * 24 * 60 * 60 , array_slice ($ commands , 1 ));
3953 break ;
54+ case "lYear " :
55+ $ this ->backUntil (time () - 365 *24 *60 *60 , array_slice ($ commands , 1 ));
56+ break ;
57+
4058 case "all " :
4159 $ this ->backUntil (0 , array_slice ($ commands , 1 ));
4260 break ;
4361 case "range " :
4462 $ this ->rangeStats (array_slice ($ commands , 1 ));
4563 break ;
46- case "today " :
47- $ commands = array_slice ($ commands , 1 );
64+
4865 default :
49- $ this ->todayview = true ;
50- $ this ->backUntil (strtotime ("today " ), $ commands );
66+ # will not happen, cause command checked in DataAccess
5167 }
5268 }
5369
0 commit comments