Fix formatting and interfaces in nearly every file
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
||||
use Log;
|
||||
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
||||
|
||||
class ClassLoader
|
||||
{
|
||||
@@ -11,7 +11,7 @@ class ClassLoader
|
||||
* @param $path
|
||||
* @return array
|
||||
*/
|
||||
public static function getClassesInPath($path)
|
||||
public static function getClassesInPath($path): array
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
return [];
|
||||
@@ -23,7 +23,7 @@ class ClassLoader
|
||||
try {
|
||||
$klass = new $cl;
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error loading class: ' . $e->getMessage());
|
||||
Log::error('Error loading class: '.$e->getMessage());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
@@ -22,9 +19,9 @@ class Dates
|
||||
|
||||
do {
|
||||
$last_value = $last_month->format('Y-m');
|
||||
$months[$last_value] = $last_month->format ('Y F');
|
||||
$months[$last_value] = $last_month->format('Y F');
|
||||
$last_month = $last_month->addMonth();
|
||||
} while($last_value !== $now);
|
||||
} while ($last_value !== $now);
|
||||
|
||||
return $months;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,13 @@ namespace App\Support;
|
||||
*/
|
||||
class ICAO
|
||||
{
|
||||
|
||||
/**
|
||||
* Create a random hex code. Eventually this may follow the format in:
|
||||
* ICAO Aeronautical Telecommunications, Annex 10, Vol. III, chapter 9
|
||||
* @param null $country
|
||||
* @return string
|
||||
*/
|
||||
public static function createHexCode($country=null)
|
||||
public static function createHexCode($country = null)
|
||||
{
|
||||
$bytes = random_bytes(4);
|
||||
return bin2hex($bytes);
|
||||
|
||||
@@ -37,14 +37,14 @@ class Math
|
||||
*/
|
||||
public static function addPercent($number, $percent): float
|
||||
{
|
||||
if(!is_numeric($number)) {
|
||||
if (!is_numeric($number)) {
|
||||
$number = (float) $number;
|
||||
}
|
||||
|
||||
if(!is_numeric($percent)) {
|
||||
if (!is_numeric($percent)) {
|
||||
$percent = (float) $percent;
|
||||
}
|
||||
|
||||
return $number + ($number * ($percent/100));
|
||||
return $number + ($number * ($percent / 100));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ class Money
|
||||
{
|
||||
public $money;
|
||||
public $subunit_amount;
|
||||
|
||||
public static $iso_currencies;
|
||||
public static $subunit_multiplier;
|
||||
|
||||
@@ -60,6 +59,7 @@ class Money
|
||||
* Create a new currency object using the currency setting
|
||||
* Fall back to USD if it's not valid
|
||||
* @return Currency
|
||||
* @throws \OutOfBoundsException
|
||||
*/
|
||||
public static function currency()
|
||||
{
|
||||
@@ -68,7 +68,6 @@ class Money
|
||||
} catch (\OutOfBoundsException $e) {
|
||||
return new Currency('USD');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,16 +144,19 @@ class Money
|
||||
/**
|
||||
* Add an amount
|
||||
* @param $amount
|
||||
* @return Money
|
||||
* @throws \UnexpectedValueException
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function add($amount)
|
||||
{
|
||||
if(!($amount instanceof self)) {
|
||||
if (!($amount instanceof self)) {
|
||||
$amount = static::createFromAmount($amount);
|
||||
}
|
||||
|
||||
$this->money = $this->money->add($amount->money);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,11 +168,12 @@ class Money
|
||||
public function addPercent($percent)
|
||||
{
|
||||
if (!is_numeric($percent)) {
|
||||
$percent = (float)$percent;
|
||||
$percent = (float) $percent;
|
||||
}
|
||||
|
||||
$amount = $this->money->multiply($percent / 100);
|
||||
$this->money = $this->money->add($amount);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -188,6 +191,7 @@ class Money
|
||||
}
|
||||
|
||||
$this->money = $this->money->subtract($amount->money);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -206,6 +210,7 @@ class Money
|
||||
}
|
||||
|
||||
$this->money = $this->money->multiply($amount->money);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -230,15 +235,16 @@ class Money
|
||||
*/
|
||||
public function equals($money)
|
||||
{
|
||||
if($money instanceof self) {
|
||||
if ($money instanceof self) {
|
||||
return $this->money->equals($money->money);
|
||||
}
|
||||
|
||||
if($money instanceof MoneyBase) {
|
||||
if ($money instanceof MoneyBase) {
|
||||
return $this->money->equals($money);
|
||||
}
|
||||
|
||||
$money = static::convertToSubunit($money);
|
||||
|
||||
return $this->money->equals(static::create($money));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ class Altitude extends \PhpUnitsOfMeasure\PhysicalQuantity\Length implements Arr
|
||||
{
|
||||
$unit = setting('units.altitude');
|
||||
$value = $this->toUnit($unit);
|
||||
|
||||
return (string) round($value, 2);
|
||||
}
|
||||
|
||||
@@ -35,8 +36,8 @@ class Altitude extends \PhpUnitsOfMeasure\PhysicalQuantity\Length implements Arr
|
||||
public function toObject()
|
||||
{
|
||||
return [
|
||||
'ft' => round($this->toUnit('feet'), 2),
|
||||
'm' => round($this->toUnit('meters') / 1000, 2),
|
||||
'ft' => round($this->toUnit('feet'), 2),
|
||||
'm' => round($this->toUnit('meters') / 1000, 2),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class Distance extends \PhpUnitsOfMeasure\PhysicalQuantity\Length implements Arr
|
||||
{
|
||||
$unit = setting('units.distance');
|
||||
$value = $this->toUnit($unit);
|
||||
|
||||
return (string) round($value, 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class Fuel extends \PhpUnitsOfMeasure\PhysicalQuantity\Mass implements Arrayable
|
||||
{
|
||||
$unit = setting('units.fuel');
|
||||
$value = $this->toUnit($unit);
|
||||
|
||||
return (string) round($value, 2);
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ class Fuel extends \PhpUnitsOfMeasure\PhysicalQuantity\Mass implements Arrayable
|
||||
public function toObject()
|
||||
{
|
||||
return [
|
||||
'kg' => round($this->toUnit('kg'), 2),
|
||||
'kg' => round($this->toUnit('kg'), 2),
|
||||
'lbs' => round($this->toUnit('lbs'), 2),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ class Mass extends \PhpUnitsOfMeasure\PhysicalQuantity\Mass implements Arrayable
|
||||
{
|
||||
$unit = setting('units.weight');
|
||||
$value = $this->toUnit($unit);
|
||||
|
||||
return (string) round($value, 2);
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ class Mass extends \PhpUnitsOfMeasure\PhysicalQuantity\Mass implements Arrayable
|
||||
public function toObject()
|
||||
{
|
||||
return [
|
||||
'kg' => round($this->toUnit('kg'), 2),
|
||||
'kg' => round($this->toUnit('kg'), 2),
|
||||
'lbs' => round($this->toUnit('lbs'), 2),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ use Illuminate\Contracts\Support\Arrayable;
|
||||
class Time implements Arrayable
|
||||
{
|
||||
public $hours,
|
||||
$minutes;
|
||||
$minutes;
|
||||
|
||||
/**
|
||||
* @param $minutes
|
||||
@@ -29,11 +29,11 @@ class Time implements Arrayable
|
||||
* @param $minutes
|
||||
* @param $hours
|
||||
*/
|
||||
public function __construct($minutes, $hours=null)
|
||||
public function __construct($minutes, $hours = null)
|
||||
{
|
||||
$minutes = (int) $minutes;
|
||||
|
||||
if(!empty($hours)) {
|
||||
if (!empty($hours)) {
|
||||
$this->hours = (int) $hours;
|
||||
} else {
|
||||
$this->hours = floor($minutes / 60);
|
||||
@@ -67,7 +67,7 @@ class Time implements Arrayable
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->hours . 'h ' . $this->minutes . 'm';
|
||||
return $this->hours.'h '.$this->minutes.'m';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ class Velocity extends \PhpUnitsOfMeasure\PhysicalQuantity\Velocity implements A
|
||||
{
|
||||
$unit = setting('units.speed');
|
||||
$value = $this->toUnit($unit);
|
||||
|
||||
return (string) round($value, 2);
|
||||
}
|
||||
|
||||
@@ -36,7 +37,7 @@ class Velocity extends \PhpUnitsOfMeasure\PhysicalQuantity\Velocity implements A
|
||||
{
|
||||
return [
|
||||
'knots' => round($this->toUnit('knots'), 2),
|
||||
'km/h' => round($this->toUnit('km/h'), 2),
|
||||
'km/h' => round($this->toUnit('km/h'), 2),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class Volume extends \PhpUnitsOfMeasure\PhysicalQuantity\Volume implements Array
|
||||
{
|
||||
$unit = setting('units.volume');
|
||||
$value = $this->toUnit($unit);
|
||||
|
||||
return (string) round($value, 2);
|
||||
}
|
||||
|
||||
@@ -35,8 +36,8 @@ class Volume extends \PhpUnitsOfMeasure\PhysicalQuantity\Volume implements Array
|
||||
public function toObject()
|
||||
{
|
||||
return [
|
||||
'gal' => round($this->toUnit('gal'), 2),
|
||||
'liters' => round($this->toUnit('liters'), 2),
|
||||
'gal' => round($this->toUnit('gal'), 2),
|
||||
'liters' => round($this->toUnit('liters'), 2),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user