Skip to content

Commit

Permalink
Merge pull request #156 from jncn/development
Browse files Browse the repository at this point in the history
Fix for missing delay/canceled info on last stop
  • Loading branch information
Pieter Colpaert committed Jan 30, 2016
2 parents 1be08cc + 9b7a41b commit 86015f8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions api/data/NMBS/vehicleinformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,22 @@ private static function getData($html, $lang, $fast)
// Time
$timenodearray = $node->children[1]->find('span');
$arriveTime = reset($timenodearray[0]->nodes[0]->_);
$departureTime = count($nodes[$i]->children[1]->children) == 3 ? reset($nodes[$i]->children[1]->children[2]->nodes[0]->_) : $arriveTime;
$departureTime = "";

// Handle last stop time, delay and canceled info
if (count($nodes[$i]->children[1]->children) == 3) {
$departureTime = reset($nodes[$i]->children[1]->children[2]->nodes[0]->_);
} else {
$departureTime = $arriveTime;
$departureDelay = $arrivalDelay;
$departureCanceled = $arrivalCanceled;
}

if (count($node->children[3]->find('a'))) {
$as = $node->children[3]->find('a');
$stationname = reset($as[0]->nodes[0]->_);
$stationname = trim(reset($as[0]->nodes[0]->_));
} else {
$stationname = reset($node->children[3]->nodes[0]->_);
$stationname = trim(reset($node->children[3]->nodes[0]->_));
}

// Platform
Expand Down

0 comments on commit 86015f8

Please sign in to comment.