API / Minn\Rest / UserObject

UserObject final readonly class

Minn\Rest\UserObject · public/minn/src/Minn/Rest/UserObject.php · 103 lines

The wp/v2 user objects: the public view shape and the edit-context shape.

Constants and properties

privatereadonly Minn\Db $db

Promoted from the constructor.

privatereadonly Minn\Content\Users $users

Promoted from the constructor.

privatereadonly Minn\Front\Permalinks $permalinks

Promoted from the constructor.

privatereadonly Minn\Rest\RestUrl $url

Promoted from the constructor.

privatereadonly Minn\Rest\Caller $caller

Promoted from the constructor.

Public

new__construct(Minn\Db $db, Minn\Content\Users $users, Minn\Front\Permalinks $permalinks, Minn\Rest\RestUrl $url, Minn\Rest\Caller $caller)#
methodview(Minn\Content\UserRecord $u): array#

A user as the view context shows one, through rest_prepare_user when a plugin hooks it.

methodedit(Minn\Content\UserRecord $u): array#

A user as the edit context shows one, through rest_prepare_user when a plugin hooks it.

staticavatarUrls(string $email): array#

Gravatar URLs in the sizes the reference emits (sha256 of the email).

Internals 2

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

privateviewFields(Minn\Content\UserRecord $u): array#

The wp/v2 user shape in the view context.

privateeditFields(Minn\Content\UserRecord $u): array#

The private fields a caller who can edit the user sees. The capabilities map is everything the user holds (allcaps), the extra ones what is stored on the user, exactly as the reference emits.