mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup.
This commit is contained in:
parent
0df8d096f0
commit
bd40615f8e
@ -31,6 +31,27 @@ class FiscalHelper implements FiscalHelperInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return Carbon date object
|
||||||
|
*/
|
||||||
|
public function endOfFiscalYear(Carbon $date)
|
||||||
|
{
|
||||||
|
// get start of fiscal year for passed date
|
||||||
|
$endDate = $this->startOfFiscalYear($date);
|
||||||
|
if ($this->useCustomFiscalYear === true) {
|
||||||
|
// add 1 year and sub 1 day
|
||||||
|
$endDate->addYear();
|
||||||
|
$endDate->subDay();
|
||||||
|
} else {
|
||||||
|
$endDate->endOfYear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $endDate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
*
|
||||||
@ -52,27 +73,7 @@ class FiscalHelper implements FiscalHelperInterface
|
|||||||
} else {
|
} else {
|
||||||
$startDate->startOfYear();
|
$startDate->startOfYear();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startDate;
|
return $startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Carbon $date
|
|
||||||
*
|
|
||||||
* @return Carbon date object
|
|
||||||
*/
|
|
||||||
public function endOfFiscalYear(Carbon $date)
|
|
||||||
{
|
|
||||||
// get start of fiscal year for passed date
|
|
||||||
$endDate = $this->startOfFiscalYear($date);
|
|
||||||
if ($this->useCustomFiscalYear === true) {
|
|
||||||
// add 1 year and sub 1 day
|
|
||||||
$endDate->addYear();
|
|
||||||
$endDate->subDay();
|
|
||||||
} else {
|
|
||||||
$endDate->endOfYear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return $endDate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -14,22 +14,22 @@ interface FiscalHelperInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method produces a clone of the Carbon date object passed, checks preferences
|
* This method produces a clone of the Carbon date object passed, checks preferences
|
||||||
* and calculates the first day of the fiscal year.
|
* and calculates the last day of the fiscal year.
|
||||||
*
|
*
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
|
||||||
* @return Carbon date object
|
|
||||||
*/
|
|
||||||
public function startOfFiscalYear(Carbon $date);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method produces a clone of the Carbon date object passed, checks preferences
|
|
||||||
* and calculates the last day of the fiscal year.
|
|
||||||
*
|
|
||||||
* @param Carbon $date
|
|
||||||
*
|
*
|
||||||
* @return Carbon date object
|
* @return Carbon date object
|
||||||
*/
|
*/
|
||||||
public function endOfFiscalYear(Carbon $date);
|
public function endOfFiscalYear(Carbon $date);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method produces a clone of the Carbon date object passed, checks preferences
|
||||||
|
* and calculates the first day of the fiscal year.
|
||||||
|
*
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return Carbon date object
|
||||||
|
*/
|
||||||
|
public function startOfFiscalYear(Carbon $date);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user