API / Minn\Runtime / Connectors

Connectors final class

Minn\Runtime\Connectors · public/minn/src/Minn/Runtime/Connectors.php · 221 lines

The connectors registry: the external services a site talks to (AI providers, spam filters, cloud services) and how each authenticates. Rows are normalised on the way in, the way the reference keeps them; the facade class hands them back to plugin code.

Uses 1

Constants and properties

privateMethods = array ( 0 => 'api_key', 1 => 'application_password', 2 => 'none', )
privateAuthenticationKeys = array ( 0 => 'method', 1 => 'credentials_url', 2 => 'setting_name', 3 => 'constant_name', 4 => 'env_var_name', )
privateMaskCap = 16

The reference stops adding bullets after sixteen, whatever the key's length.

privatearray $rows

Public

methodregister(string $id, array $args): ?Minn\Runtime\Refusal#

Registers a connector, or the refusal.

methodunregister(string $id): ?array#

Forgets a connector; its row, or null.

@return array<string, mixed>|null the row that was registered, null when there was none
methodall(): array#

Every connector.

@return array<string, array<string, mixed>>
methodget(string $id): ?array#

One connector, or null.

methodhas(string $id): bool#

Whether a connector is registered.

methodregisterAiProviders(Closure $loaded): void#

The reference's three AI providers. Whether a provider's plugin is active is asked of the caller's closure, by the connector's id, when asked (probe connector-defaults).

$loadedClosure(string): bool
methodregisterAkismet(Closure $loaded): void#

Akismet, the spam filter connector the reference adds after the AI providers. Whether its plugin is active is asked of the caller's closure.

$loadedClosure(): bool
staticmask(string $key): string#

Keys of four characters or fewer are shown whole; longer ones keep their last four behind at most sixteen bullets.

statickeySource(string $setting, string $envVar, string $constant, Closure $option): string#

Where a key comes from, in the reference's precedence: the environment, then a constant, then the stored option; empty values do not count.

$optionClosure(string): mixed
staticparseCredentials(string $value): array#

"user:password" split at the first colon, both halves trimmed; anything else is empty credentials.

staticsanitizeCredentials(mixed $value, Closure $clean): array#

Stored credentials are an array of two text fields; a string, even a "user:password" one, is not accepted from storage.

$cleanClosure(string): string
staticcredentials(array $auth, Closure $option, Closure $clean): array#

The credentials a connector authenticates with, from the same three sources as a key, plus where they came from.

$optionClosure(string): mixed
$cleanClosure(string): string

Internals 1

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

privatenormalise(string $id, array $args, array $authentication, array $plugin): array#
@return array<string, mixed>