API / Minn\Runtime / UserInsert

UserInsert final readonly class

Minn\Runtime\UserInsert · public/minn/src/Minn/Runtime/UserInsert.php · 122 lines

The decisions behind wp_insert_user: what a new account needs, which email and login collide, the resolved profile fields, and which columns an update changes. The sanitisers and lookups arrive as closures so the reference's filters apply. Behaviour pinned by contracts/fixtures/api/functions.json.

Uses 1

Constants and properties

constMETA_KEYS = array ( 0 => 'nickname', 1 => 'first_name', 2 => 'last_name', 3 => 'description', 4 => 'rich_editing', 5 => 'syntax_highlighting', 6 => 'comment_shortcuts', 7 => 'admin_color', 8 => 'use_ssl', 9 => 'show_admin_bar_front', 10 => 'locale', )
privatereadonly Closure $sanitizeLogin

Promoted from the constructor.

privatereadonly Closure $sanitizeSlug

Promoted from the constructor.

privatereadonly Closure $isEmail

Promoted from the constructor.

privatereadonly Closure $loginTaken

Promoted from the constructor.

privatereadonly Closure $emailOwner

Promoted from the constructor.

privatereadonly Closure $roleExists

Promoted from the constructor.

Public

new__construct(Closure $sanitizeLogin, Closure $sanitizeSlug, Closure $isEmail, Closure $loginTaken, Closure $emailOwner, Closure $roleExists)#
$sanitizeLoginClosure(string): string
$sanitizeSlugClosure(string): string
$isEmailClosure(string): bool
$loginTakenClosure(string): bool
$emailOwnerClosure(string): int0 when nobody has it
$roleExistsClosure(string): bool
methodresolve(array $userdata, ?array $existing): Minn\Runtime\Refusal|array#

The validated, resolved fields, or the refusal the reference gives.

$userdataarray<string, mixed>
$existingarray<string, mixed>|nullthe current row on an update
@return array{login: string, email: string, nicename: ?string, display_name: string, role: ?string}|Refusal
staticaccount(array $userdata, array $resolved, string $defaultRole): array#

The fields a new account is created from. @param array{login: string, email: string, nicename: ?string, display_name: string, role: ?string} $resolved @return array<string, mixed>

$resolvedarray{login: string, email: string, nicename: ?string, display_name: string, role: ?string}@return array<string, mixed>
staticchanges(array $userdata, array $existing, array $resolved, Closure $url, Closure $hash): array#

The columns an update actually changes.

$existingarray<string, mixed>
$resolvedarray{login: string, email: string, nicename: ?string, display_name: string, role: ?string}
$urlClosure(string): stringthe URL sanitiser
$hashClosure(string): stringthe password hasher
@return array<string, string>