@@ -210,16 +210,16 @@ public function getTableData($tableName)
210
210
return $ this ->downloadCSV_XTRA (
211
211
$ this ->getWebsite (),
212
212
$ tableName ,
213
- $ this ->_dateStart ,
214
- $ this ->_dateEnd
213
+ $ this ->getDateStart () ,
214
+ $ this ->getDateEnd ()
215
215
);
216
216
break ;
217
217
default : // TOP_QUERIES || TOP_PAGES
218
218
$ downloadUrls = $ this ->getDownloadUrls ($ this ->getWebsite ());
219
219
$ finalUrl = $ downloadUrls [$ tableName ] . '&prop=ALL&db=%s&de=%s&more=true ' ;
220
220
$ finalUrl = sprintf (
221
221
$ finalUrl ,
222
- $ this ->_dateStart ->format ('Ymd ' ), $ this ->_dateEnd ->format ('Ymd ' )
222
+ $ this ->getDateStart () ->format ('Ymd ' ), $ this ->getDateEnd () ->format ('Ymd ' )
223
223
);
224
224
return $ this ->getData ($ finalUrl );
225
225
}
@@ -393,6 +393,36 @@ public function setDateRange(DateTime $dateStart, DateTime $dateEnd)
393
393
return $ this ;
394
394
}
395
395
396
+ /**
397
+ * Get date start value
398
+ *
399
+ * @throws Exception
400
+ * @return DateTime
401
+ */
402
+ public function getDateStart ()
403
+ {
404
+ if (null === $ this ->_dateStart ) {
405
+ throw new Exception ('You must set a dateStart value. ' );
406
+ }
407
+
408
+ return $ this ->_dateStart ;
409
+ }
410
+
411
+ /**
412
+ * Get date end value
413
+ *
414
+ * @throws Exception
415
+ * @return DateTime
416
+ */
417
+ public function getDateEnd ()
418
+ {
419
+ if (null === $ this ->_dateEnd ) {
420
+ throw new Exception ('You must set a dateEnd value. ' );
421
+ }
422
+
423
+ return $ this ->_dateEnd ;
424
+ }
425
+
396
426
/**
397
427
* Returns array of downloaded filenames.
398
428
*
@@ -637,7 +667,7 @@ public function downloadCSV($site, $savepath = '.')
637
667
$ tables = $ this ->_tables ;
638
668
foreach ($ tables as $ table ) {
639
669
$ this ->saveData (
640
- $ this ->getTableData ($ table , $ site , $ this ->_dateStart , $ this ->_dateEnd , $ this ->getLanguage ()),
670
+ $ this ->getTableData ($ table , $ site , $ this ->getDateStart () , $ this ->getDateEnd () , $ this ->getLanguage ()),
641
671
"$ savepath/ $ table- $ filename.csv "
642
672
);
643
673
}
0 commit comments