mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -35,9 +35,9 @@ trait CalculateRangeOccurrences
|
||||
/**
|
||||
* Get the number of daily occurrences for a recurring transaction until date $end is reached. Will skip every $skipMod-1 occurrences.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -59,10 +59,10 @@ trait CalculateRangeOccurrences
|
||||
/**
|
||||
* Get the number of daily occurrences for a recurring transaction until date $end is reached. Will skip every $skipMod-1 occurrences.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
@@ -71,7 +71,7 @@ trait CalculateRangeOccurrences
|
||||
{
|
||||
$return = [];
|
||||
$attempts = 0;
|
||||
$dayOfMonth = (int) $moment;
|
||||
$dayOfMonth = (int)$moment;
|
||||
if ($start->day > $dayOfMonth) {
|
||||
// day has passed already, add a month.
|
||||
$start->addMonth();
|
||||
@@ -92,10 +92,10 @@ trait CalculateRangeOccurrences
|
||||
/**
|
||||
* Get the number of daily occurrences for a recurring transaction until date $end is reached. Will skip every $skipMod-1 occurrences.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -124,10 +124,10 @@ trait CalculateRangeOccurrences
|
||||
/**
|
||||
* Get the number of daily occurrences for a recurring transaction until date $end is reached. Will skip every $skipMod-1 occurrences.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
@@ -139,7 +139,7 @@ trait CalculateRangeOccurrences
|
||||
Log::debug('Rep is weekly.');
|
||||
// monday = 1
|
||||
// sunday = 7
|
||||
$dayOfWeek = (int) $moment;
|
||||
$dayOfWeek = (int)$moment;
|
||||
Log::debug(sprintf('DoW in repetition is %d, in mutator is %d', $dayOfWeek, $start->dayOfWeekIso));
|
||||
if ($start->dayOfWeekIso > $dayOfWeek) {
|
||||
// day has already passed this week, add one week:
|
||||
@@ -168,10 +168,10 @@ trait CalculateRangeOccurrences
|
||||
/**
|
||||
* Get the number of daily occurrences for a recurring transaction until date $end is reached. Will skip every $skipMod-1 occurrences.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
|
@@ -35,9 +35,9 @@ trait CalculateXOccurrences
|
||||
* Calculates the number of daily occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -63,10 +63,10 @@ trait CalculateXOccurrences
|
||||
* Calculates the number of monthly occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ trait CalculateXOccurrences
|
||||
$mutator = clone $date;
|
||||
$total = 0;
|
||||
$attempts = 0;
|
||||
$dayOfMonth = (int) $moment;
|
||||
$dayOfMonth = (int)$moment;
|
||||
if ($mutator->day > $dayOfMonth) {
|
||||
// day has passed already, add a month.
|
||||
$mutator->addMonth();
|
||||
@@ -100,10 +100,10 @@ trait CalculateXOccurrences
|
||||
* Calculates the number of NDOM occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -138,10 +138,10 @@ trait CalculateXOccurrences
|
||||
* Calculates the number of weekly occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -154,7 +154,7 @@ trait CalculateXOccurrences
|
||||
// monday = 1
|
||||
// sunday = 7
|
||||
$mutator->addDay(); // always assume today has passed.
|
||||
$dayOfWeek = (int) $moment;
|
||||
$dayOfWeek = (int)$moment;
|
||||
if ($mutator->dayOfWeekIso > $dayOfWeek) {
|
||||
// day has already passed this week, add one week:
|
||||
$mutator->addWeek();
|
||||
@@ -180,10 +180,10 @@ trait CalculateXOccurrences
|
||||
* Calculates the number of yearly occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $date
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@@ -36,10 +36,10 @@ trait CalculateXOccurrencesSince
|
||||
* Calculates the number of daily occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -66,11 +66,11 @@ trait CalculateXOccurrencesSince
|
||||
* Calculates the number of monthly occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -81,7 +81,7 @@ trait CalculateXOccurrencesSince
|
||||
$mutator = clone $date;
|
||||
$total = 0;
|
||||
$attempts = 0;
|
||||
$dayOfMonth = (int) $moment;
|
||||
$dayOfMonth = (int)$moment;
|
||||
$dayOfMonth = 0 === $dayOfMonth ? 1 : $dayOfMonth;
|
||||
if ($mutator->day > $dayOfMonth) {
|
||||
Log::debug(sprintf('%d is after %d, add a month. Mutator is now', $mutator->day, $dayOfMonth));
|
||||
@@ -109,11 +109,11 @@ trait CalculateXOccurrencesSince
|
||||
* Calculates the number of NDOM occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -149,11 +149,11 @@ trait CalculateXOccurrencesSince
|
||||
* Calculates the number of weekly occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -168,7 +168,7 @@ trait CalculateXOccurrencesSince
|
||||
// sunday = 7
|
||||
// Removed assumption today has passed, see issue https://github.com/firefly-iii/firefly-iii/issues/4798
|
||||
//$mutator->addDay(); // always assume today has passed.
|
||||
$dayOfWeek = (int) $moment;
|
||||
$dayOfWeek = (int)$moment;
|
||||
if ($mutator->dayOfWeekIso > $dayOfWeek) {
|
||||
// day has already passed this week, add one week:
|
||||
$mutator->addWeek();
|
||||
@@ -194,11 +194,11 @@ trait CalculateXOccurrencesSince
|
||||
* Calculates the number of yearly occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
* @param Carbon $date
|
||||
* @param Carbon $afterDate
|
||||
* @param int $count
|
||||
* @param int $skipMod
|
||||
* @param string $moment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@@ -37,8 +37,8 @@ trait FiltersWeekends
|
||||
/**
|
||||
* Filters out all weekend entries, if necessary.
|
||||
*
|
||||
* @param RecurrenceRepetition $repetition
|
||||
* @param array $dates
|
||||
* @param RecurrenceRepetition $repetition
|
||||
* @param array $dates
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
@@ -46,7 +46,7 @@ trait FiltersWeekends
|
||||
protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
if ((int) $repetition->weekend === RecurrenceRepetition::WEEKEND_DO_NOTHING) {
|
||||
if ((int)$repetition->weekend === RecurrenceRepetition::WEEKEND_DO_NOTHING) {
|
||||
Log::debug('Repetition will not be filtered on weekend days.');
|
||||
|
||||
return $dates;
|
||||
|
Reference in New Issue
Block a user