/**
* @return AircraftCollection
*/
public function getAllAircraft()
{
if ($this->cacheEnabled) {
$cacheItem = $this->cachePool->getItem('aircraftCollection');
$aircraftCollection = $cacheItem->get();
if ($cacheItem->isHit()) {
return $aircraftCollection;
}
}
$fileObjects = $this->recursiveIterator;
$aircraftCollection = $this->aircraftCollection;
foreach ($fileObjects as $file) {
if ($file->getFilename() === 'aircraft.json') {
$json = file_get_contents($file->getPathName());
if ($json) {
$aircraftConfig = json_decode($json);
$aircraftConfig->path = $file->getPath();
$aircraftCollection->push($aircraftConfig);
}
}
}
if ($this->cacheEnabled) {
$this->cachePool->save($cacheItem->set($aircraftCollection));
}
return $aircraftCollection;
}