Refactor all of the unit conversion code
This commit is contained in:
@@ -27,7 +27,7 @@ class Flight extends Resource
|
||||
|
||||
// Return multiple measures so the client can pick what they want
|
||||
if ($this->distance instanceof Distance) {
|
||||
$flight['distance'] = $this->distance->toObject();
|
||||
$flight['distance'] = $this->distance->units;
|
||||
}
|
||||
|
||||
$flight['airline'] = new Airline($this->airline);
|
||||
|
||||
@@ -9,7 +9,6 @@ class JournalTransaction extends Resource
|
||||
public function toArray($request)
|
||||
{
|
||||
$transaction = parent::toArray($request);
|
||||
|
||||
return $transaction;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,15 @@ class Pirep extends Resource
|
||||
$pirep = parent::toArray($request);
|
||||
|
||||
if ($this->distance instanceof Distance) {
|
||||
$pirep['distance'] = $this->distance->toObject();
|
||||
$pirep['distance'] = $this->distance->units;
|
||||
}
|
||||
|
||||
if ($this->fuel_used instanceof Fuel) {
|
||||
$pirep['fuel_used'] = $this->fuel_used->toObject();
|
||||
$pirep['fuel_used'] = $this->fuel_used->units;
|
||||
}
|
||||
|
||||
if ($this->planned_distance instanceof Distance) {
|
||||
$pirep['planned_distance'] = $this->planned_distance->toObject();
|
||||
$pirep['planned_distance'] = $this->planned_distance->units;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user