Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -1,6 +1,5 @@
<?php
/*
* Bimonthly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>

View File

@@ -1,6 +1,5 @@
<?php
/*
* Daily.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
@@ -32,14 +31,8 @@ use Carbon\Carbon;
*/
final class Daily extends Interval
{
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon
{
return ($date->clone())->addDays($this->skip($interval));
return $date->clone()->addDays($this->skip($interval));
}
}

View File

@@ -1,6 +1,5 @@
<?php
/*
* Fortnightly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>

View File

@@ -1,6 +1,5 @@
<?php
/*
* HalfYearly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>

View File

@@ -1,6 +1,5 @@
<?php
/*
* Interspacable.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
@@ -32,11 +31,5 @@ use Carbon\Carbon;
*/
interface Interspacable
{
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon;
}

View File

@@ -1,6 +1,5 @@
<?php
/*
* Interval.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
@@ -32,11 +31,6 @@ abstract class Interval implements Interspacable
{
public const int INTERVAL = 1;
/**
* @param int $skip
*
* @return int
*/
final public function skip(int $skip): int
{
return static::INTERVAL * $skip;

View File

@@ -1,6 +1,5 @@
<?php
/*
* Monthly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
@@ -32,14 +31,8 @@ use Carbon\Carbon;
*/
class Monthly extends Interval
{
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon
{
return ($date->clone())->addMonthsNoOverflow($this->skip($interval));
return $date->clone()->addMonthsNoOverflow($this->skip($interval));
}
}

View File

@@ -1,6 +1,5 @@
<?php
/*
* Quarterly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>

View File

@@ -1,6 +1,5 @@
<?php
/*
* Weekly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
@@ -32,14 +31,8 @@ use Carbon\Carbon;
*/
class Weekly extends Interval
{
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon
{
return ($date->clone())->addWeeks($this->skip($interval));
return $date->clone()->addWeeks($this->skip($interval));
}
}

View File

@@ -1,6 +1,5 @@
<?php
/*
* Yearly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
@@ -32,14 +31,8 @@ use Carbon\Carbon;
*/
final class Yearly extends Interval
{
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon
{
return ($date->clone())->addYearsNoOverflow($this->skip($interval));
return $date->clone()->addYearsNoOverflow($this->skip($interval));
}
}