fix gitlab tests
This commit is contained in:
@@ -7,7 +7,9 @@ use DateTimeImmutable;
|
||||
|
||||
class SemesterRangeService
|
||||
{
|
||||
public function __construct(private SemesterConfigService $configService) {}
|
||||
public function __construct(private SemesterConfigService $configService)
|
||||
{
|
||||
}
|
||||
|
||||
public function getSchoolYearRange(string $schoolYear): array
|
||||
{
|
||||
@@ -29,7 +31,7 @@ class SemesterRangeService
|
||||
|
||||
public function getSemesterRange(string $schoolYear, string $semester): ?array
|
||||
{
|
||||
if (! preg_match('/^(\\d{4})-(\\d{4})$/', $schoolYear, $m)) {
|
||||
if (!preg_match('/^(\\d{4})-(\\d{4})$/', $schoolYear, $m)) {
|
||||
return null;
|
||||
}
|
||||
$y1 = (int) $m[1];
|
||||
@@ -55,7 +57,6 @@ class SemesterRangeService
|
||||
if ($value === 'spring') {
|
||||
return 'Spring';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -102,15 +103,13 @@ class SemesterRangeService
|
||||
if (preg_match('/^(\\d{4})-(\\d{4})$/', $schoolYear, $m)) {
|
||||
$y1 = (int) $m[1];
|
||||
$y2 = (int) $m[2];
|
||||
|
||||
return [new DateTimeImmutable($y1.'-09-01'), new DateTimeImmutable($y2.'-06-30')];
|
||||
return [new DateTimeImmutable($y1 . '-09-01'), new DateTimeImmutable($y2 . '-06-30')];
|
||||
}
|
||||
|
||||
$currentYear = (int) date('Y');
|
||||
|
||||
return [
|
||||
new DateTimeImmutable($currentYear.'-09-01'),
|
||||
new DateTimeImmutable(($currentYear + 1).'-06-30'),
|
||||
new DateTimeImmutable($currentYear . '-09-01'),
|
||||
new DateTimeImmutable(($currentYear + 1) . '-06-30'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user