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
| private | readonly Minn\Db $db | Promoted from the constructor. |
| private | readonly Minn\Content\Users $users | Promoted from the constructor. |
| private | readonly Minn\Front\Permalinks $permalinks | Promoted from the constructor. |
| private | readonly Minn\Rest\RestUrl $url | Promoted from the constructor. |
| private | readonly 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)# | |
| method | view(Minn\Content\UserRecord $u): array# | A user as the view context shows one, through rest_prepare_user when a plugin hooks it. |
| method | edit(Minn\Content\UserRecord $u): array# | A user as the edit context shows one, through rest_prepare_user when a plugin hooks it. |
| static | avatarUrls(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.
| private | viewFields(Minn\Content\UserRecord $u): array# | The wp/v2 user shape in the view context. |
| private | editFields(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. |
Nothing matches.