DirectoryApi final readonly class
Minn\Ops\DirectoryApi · public/minn/src/Minn/Ops/DirectoryApi.php · 56 lines
plugins_api() and themes_api() as plugins call them and answer them (probes plugins-api, themes-api), one class for both ($kind 'plugins' or 'themes'): the arguments as an object with the reader's locale and the major.minor version beside them, through <kind>_api_args; then whatever a plugin answers through <kind>_api (a seller's own information, or an error) stands, and only when nobody answers is the directory asked, through Ops\Packages (behind the Minn update service); <kind>_api_result is handed what came back either way. A refusal is <kind>_api_failed in the directory's own words.
Constants and properties
| private | readonly string $kind | Promoted from the constructor. |
| private | readonly Closure $filter | Promoted from the constructor. |
| private | readonly Minn\Ops\Packages $packages | Promoted from the constructor. |
| private | readonly string $locale | Promoted from the constructor. |
| private | readonly string $version | Promoted from the constructor. |
Public
| new | __construct(string $kind, Closure $filter, Minn\Ops\Packages $packages, string $locale, string $version)# |
| |||
| method | ask(string $action, object|array $args): mixed# | The answer for an action (plugin_information, query_themes, ...): an object, a WP_Error, or what a plugin returned. |
Internals 2
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | directory(string $action, array $request): object# |
| |||
| private | unexpected(string $body): WP_Error# | An answer that is not JSON. wordpress.org words an unknown theme action as JSON to WordPress but as a paragraph to anyone else (the update service), so the paragraph is read as the refusal WordPress would have been given; anything else is the reference's own message for an answer it cannot read, the body kept as its data. |
Nothing matches.