Skip to content

12B: Let the queue that holds the notices say where they are - #23

Open
nikolaystrikhar wants to merge 1 commit into
12A-conflict-gatesfrom
12B-notices-queue-option
Open

12B: Let the queue that holds the notices say where they are#23
nikolaystrikhar wants to merge 1 commit into
12A-conflict-gatesfrom
12B-notices-queue-option

Conversation

@nikolaystrikhar

Copy link
Copy Markdown
Contributor

What: moves option_name() off Notices\Queue and Notices\Store as a public static and onto Notices\Contracts\Queue_Interface as an instance method.

Usage:

$option = Absorber::notices()->option_name();

foreach ( get_site_option( $option, [] ) as $notice ) {
    // Render them yourself.
}

Why this way:

The honest answer depends on which queue the site is running. A static answers for the default implementation whatever is actually bound, so on a site that rebound Queue_Interface to keep notices elsewhere, the snippet in docs/notices.md read an option nothing writes to.

On the contract rather than the default class. The docs invite a host to read the option and render the notices itself, so the object it holds has to be able to answer for itself. Store keeps the composition, since it is the class that owns the option.

Queue::option_name() and Store::option_name() were public static, and public
is earned here -- docs/notices.md tells a host to read the option and render
the notices itself. Static was not: it answers for the default implementation
whatever the site is actually running, so on a site that rebound
Queue_Interface to keep notices elsewhere, the documented snippet read an
option nothing writes to.

It moves onto Queue_Interface as an instance method, so the object a host
holds answers for itself, and the docs ask Absorber::notices() for the name.
Store keeps the composition, since it is the class that owns the option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants