Skip to content

Firefly III: a personal finances manager

Code cleanup.

James Colebd40615f8e27
diff --git a/app/Helpers/FiscalHelper.php b/app/Helpers/FiscalHelper.php
index 1d33aa5d8f..5b15450be8 100644
--- a/app/Helpers/FiscalHelper.php
+++ b/app/Helpers/FiscalHelper.php
@@ -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
*
@@ -52,27 +73,7 @@ class FiscalHelper implements FiscalHelperInterface
} else {
$startDate->startOfYear();
}
- 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;
+ return $startDate;
}
}
diff --git a/app/Helpers/FiscalHelperInterface.php b/app/Helpers/FiscalHelperInterface.php
index f4ec6fba1a..e5f805a855 100644
--- a/app/Helpers/FiscalHelperInterface.php
+++ b/app/Helpers/FiscalHelperInterface.php
@@ -14,22 +14,22 @@ interface FiscalHelperInterface
/**
* 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);
+ public function endOfFiscalYear(Carbon $date);
/**
- * This method produces a clone of the Carbon date object passed, checks preferences
- * and calculates the last day of the fiscal year.
+ * 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
+ * @param Carbon $date
*
* @return Carbon date object
*/
- public function endOfFiscalYear(Carbon $date);
+ public function startOfFiscalYear(Carbon $date);
}