API / Minn\Admin / ActivityChart

ActivityChart final readonly class

Minn\Admin\ActivityChart · public/minn/src/Minn/Admin/ActivityChart.php · 65 lines

The overview's activity chart: published posts and pages plus every comment, counted per bar. A window over 45 days is drawn in weeks, anything shorter in days; each bar carries the (from, to] GMT bounds the drill-down asks for.

Constants and properties

privatereadonly Minn\Db $db

Promoted from the constructor.

privatereadonly Minn\Content\Site $site

Promoted from the constructor.

Public

new__construct(Minn\Db $db, Minn\Content\Site $site)#
methodbars(int $days, int $now): array#

The bars for a window of days, counted from the database.

@return list<array{label: string, value: int, from: string, to: string}>
staticbucket(array $dates, int $days, int $now, int $offset): array#

GMT stamps into bars, oldest first. Labels are site-local: the day for daily bars, "Week of" the bar's first day for weekly ones.

$dateslist<string>"Y-m-d H:i:s" in GMT
@return list<array{label: string, value: int, from: string, to: string}>