Documentation

GetStreakStatistics

Calculates current streak, best streak, and total active days.

A streak is a run of consecutive calendar days with any activity. The current streak only counts if the most recent active day is today or yesterday.

Tags
since
3.0.0

Table of Contents

Properties

$repository  : ActivityRepositoryInterface

Methods

__construct()  : mixed
Constructor.
execute()  : StreakResult
Execute the use case.
countConsecutiveFromStart()  : int
Count consecutive days starting from the first date in the list.

Properties

Methods

countConsecutiveFromStart()

Count consecutive days starting from the first date in the list.

private countConsecutiveFromStart(array<int, string> $dates, DateTimeImmutable $firstDate) : int
Parameters
$dates : array<int, string>

Dates descending

$firstDate : DateTimeImmutable

The most recent date

Return values
int

Consecutive day count


        
On this page

Search results