mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
/*
|
||||
* Bimonthly.php
|
||||
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
/*
|
||||
* Fortnightly.php
|
||||
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
/*
|
||||
* HalfYearly.php
|
||||
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
/*
|
||||
* Quarterly.php
|
||||
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user