]> Raphaël G. Git Repositories - airbundle/blobdiff - Command/WeatherCommand.php
List dance sessions
[airbundle] / Command / WeatherCommand.php
index c6fe6fcad4c9bd0761bc16d1f9fe21a66b8c1e34..0318383671451ebc6ad93e40dc6d19fc7937947d 100644 (file)
@@ -177,6 +177,12 @@ class WeatherCommand extends DoctrineCommand {
                                //Set stop day
                                $day = $stop->diff((new \DateTime('now'))->setTime(0, 0, 0))->d + 1;
 
+                               //Skip 4th day
+                               //XXX: accuweather only allow until 3rd day
+                               if ($day >= 4) {
+                                       continue;
+                               }
+
                                //Check if zipcode date is set
                                if (!isset($zipcodes[$zipcode][$day])) {
                                        $zipcodes[$zipcode][$day] = [ $sessionId => $sessionId ];
@@ -265,7 +271,7 @@ class WeatherCommand extends DoctrineCommand {
                                        //Iterate on each link containing data
                                        foreach($sx->xpath('//a[contains(@class,"daily-forecast-card")]') as $node) {
                                                //Get date
-                                               $dsm = trim($node->div[0]->h2[0]->span[1]);
+                                               $dsm = trim((string)$node->div[0]->h2[0]->span[1]);
 
                                                //Get temperature
                                                $temperature = str_replace('°', '', (string)$node->div[0]->div[0]->span[0]);