<?php
namespace ModulesAbstract\PluginReports\ExtraSupport\ItineraryAnalyser; class ItineraryAnalyser extends \App\Utils\Itinerary\ItineraryAnalyser { public function fillItineraryGaps() { $recomposedItinerary = new \App\Itinerary(); $segments = $this->itinerary->getSegments(); foreach ($segments as $index => $segment) { $segmentArr = $segment->exportAsArray(); $newSegment = new \ModulesAbstract\PluginReports\ExtraSupport\ItineraryAnalyser\ItinerarySegment(); $newSegment->importFromArray($segmentArr); $recomposedItinerary->addSegment($newSegment); if ($segments[$index+1] and $segment->getArrivalStationCode() !== $segments[$index+1]->getDepartureStationCode()) { $newSegment = new \ModulesAbstract\PluginReports\ExtraSupport\ItineraryAnalyser\ItinerarySegment(); $newSegment->setDepartureDateTime($segment->getDepartureDateTime()); $newSegment->setDeparturePlace($segment->getArrivalCountryCode(), $segment->getArrivalCityId(), $segment->getArrivalStationCode()); $newSegment->setArrivalDateTime($segments[$index+1]->getArrivalDateTime()); $newSegment->setArrivalPlace($segments[$index+1]->getDepartureCountryCode(), $segments[$index+1]->getDepartureCityId(), $segments[$index+1]->getDepartureStationCode()); $newSegment->setType("ARNK"); $recomposedItinerary->addSegment($newSegment); } } $this->itinerary = $recomposedItinerary; return $this; } }