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