API / Minn\Front / Calendar

Calendar final readonly class

Minn\Front\Calendar · public/minn/src/Minn/Front/Calendar.php · 99 lines

One month as the calendar widget and block draw it: a table whose caption names the month, whose head lists the week from the site's first day, and whose cells link the days a post was published on to that day's archive; today's cell carries the id the stylesheet lights; the nav below links the nearest months with posts on either side. Markup, whitespace and the attribute order of the two padding cells follow the reference byte for byte, since themes style the table by those hooks.

Constants and properties

privateFIXED_DATE = 'F j, Y'
privatereadonly int $year

Promoted from the constructor.

privatereadonly int $month

Promoted from the constructor.

privatereadonly int $weekStart

Promoted from the constructor.

privatereadonly Minn\Front\CalendarLabels $labels

Promoted from the constructor.

privatereadonly Closure $link

Promoted from the constructor.

Public

new__construct(int $year, int $month, int $weekStart, Minn\Front\CalendarLabels $labels, Closure $link)#
$linkClosure(int, int, ?int): stringthe month archive URL, or the day's when a day is given
methodrender(array $postDays, ?array $previous, ?array $next, ?array $today): string#

The table and its navigation.

$postDayslist<int>days of the month with a published post
$previousarray{int, int}|nullthe nearest earlier month with posts, as [year, month]
$nextarray{int, int}|nullthe nearest later month with posts
$todayarray{int, int, int}|nullthe site's current date, as [year, month, day]

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatetable(array $postDays, ?array $today): string#
$postDayslist<int>
privatehead(): string#
privatecell(int $day, array $postDays, ?array $today): string#
$postDayslist<int>
$todayarray{int, int, int}|null
privatenavigation(?array $previous, ?array $next): string#
$previousarray{int, int}|null
$nextarray{int, int}|null
privateabbreviation(int $month): string#