Remove ext-cal from requirements list (#349)
* Remove ext-cal from requirements list * Fix the travis phpunit config
This commit is contained in:
parent
f6465bea58
commit
ff6ba4c29a
@ -22,7 +22,7 @@
|
||||
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/>
|
||||
</listeners>
|
||||
<php>
|
||||
<env name="APP_ENV" value="test"/>
|
||||
<env name="APP_ENV" value="unittest"/>
|
||||
<env name="APP_KEY" value="base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI="/>
|
||||
<env name="APP_DEBUG" value="true"/>
|
||||
<env name="APP_LOG_LEVEL" value="debug"/>
|
||||
|
@ -2,8 +2,9 @@
|
||||
|
||||
namespace App\Contracts;
|
||||
|
||||
use Cache;
|
||||
use Log;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Base class for implementing retrieving METARs
|
||||
@ -43,7 +44,7 @@ abstract class Metar
|
||||
$raw_metar = Cache::remember($key, $cache['time'], function () use ($icao) {
|
||||
try {
|
||||
return $this->metar($icao);
|
||||
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
|
||||
} catch (GuzzleException $e) {
|
||||
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
|
||||
return '';
|
||||
} catch (\Exception $e) {
|
||||
|
@ -38,11 +38,27 @@ class Dates
|
||||
public static function getMonthBoundary($month): array
|
||||
{
|
||||
[$year, $month] = explode('-', $month);
|
||||
$days = \cal_days_in_month(CAL_GREGORIAN, $month, $year);
|
||||
$days = static::getDaysInMonth($month, $year);
|
||||
|
||||
return [
|
||||
"$year-$month-01",
|
||||
"$year-$month-$days",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of days in a month
|
||||
* https://www.php.net/manual/en/function.cal-days-in-month.php#38666
|
||||
*
|
||||
* @param int $month
|
||||
* @param int $year
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function getDaysInMonth($month, $year): int
|
||||
{
|
||||
$month = (int) $month;
|
||||
$year = (int) $year;
|
||||
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
"homepage": "http://www.phpvms.net",
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"ext-calendar": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
|
@ -15,7 +15,6 @@ return [
|
||||
],
|
||||
|
||||
'extensions' => [
|
||||
'calendar',
|
||||
'openssl',
|
||||
'pdo',
|
||||
'mbstring',
|
||||
|
Loading…
Reference in New Issue
Block a user