/**
  * @param string $fromUnLocode
  * @param string $toUnLocode
  * @return TransitPathDto[]
  */
 public function findShortestPath($fromUnLocode, $toUnLocode)
 {
     $transitPath = new TransitPathDto();
     $fromDate = new \DateTime('2014-03-29 19:59:23');
     $toDate = new \DateTime('2014-03-30 21:30:00');
     $edge = new EdgeDto();
     $edge->setFromUnLocode($fromUnLocode);
     $edge->setToUnLocode($toUnLocode);
     $edge->setFromDate($fromDate->format(\DateTime::ISO8601));
     $edge->setToDate($toDate->format(\DateTime::ISO8601));
     $transitPath->setEdges([$edge]);
     return [$transitPath];
 }
 /**
  * @param array $route
  * @return TransitPathDto
  */
 private function routeToTransitPath(array $route)
 {
     $edges = array();
     $loadDay = \rand(1, 4);
     $loadTimestamp = strtotime("+{$loadDay} day");
     $loadTime = new \DateTime();
     $loadTime->setTimestamp($loadTimestamp);
     $elapsedDays = 0;
     $currentLocation = $route['origin'];
     $currentTime = $loadTime;
     if (!empty($route['stops'])) {
         foreach ($route['stops'] as $unLocode => $duration) {
             $elapsedDays += $duration;
             $durationInterval = new \DateInterval('P' . $duration . 'DT' . \rand(1, 12) . 'H' . \rand(1, 60) . 'M');
             $currentTime->add(new \DateInterval('P1DT' . \rand(1, 12) . 'H' . \rand(1, 60) . 'M'));
             $loadTime = clone $currentTime;
             $currentTime->add($durationInterval);
             $unloadTime = clone $currentTime;
             $edge = new EdgeDto();
             $edge->setFromUnLocode($currentLocation);
             $edge->setToUnLocode($unLocode);
             $edge->setFromDate($loadTime->format(\DateTime::ISO8601));
             $edge->setToDate($unloadTime->format(\DateTime::ISO8601));
             $edges[] = $edge;
             $currentLocation = $unLocode;
         }
     }
     $destinationDuration = $route['duration'] - $elapsedDays;
     $durationInterval = new \DateInterval('P' . $destinationDuration . 'DT' . \rand(1, 12) . 'H' . \rand(1, 60) . 'M');
     $currentTime->add(new \DateInterval('P1DT' . \rand(1, 12) . 'H' . \rand(1, 60) . 'M'));
     $loadTime = clone $currentTime;
     $currentTime->add($durationInterval);
     $unloadTime = clone $currentTime;
     $edge = new EdgeDto();
     $edge->setFromUnLocode($currentLocation);
     $edge->setToUnLocode($route['destination']);
     $edge->setFromDate($loadTime->format(\DateTime::ISO8601));
     $edge->setToDate($unloadTime->format(\DateTime::ISO8601));
     $edges[] = $edge;
     $transitPath = new TransitPathDto();
     $transitPath->setEdges($edges);
     return $transitPath;
 }