Raw capabilities metadata. Keys that are role names * (Context::$roles) are roles, the others are capabilities granted directly. * - isSuperAdmin bool is_super_admin() on multisite. * - exists bool False for a metadata row whose user_id has no row in the users table. * * @package Timaub\AfterHackChecklist */ namespace Timaub\AfterHackChecklist\Domain; final class UserEntry { /** @var int */ public $id = 0; /** @var string */ public $login = ''; /** @var string */ public $registered = ''; /** @var array */ public $capabilities = array(); /** @var bool */ public $isSuperAdmin = false; /** @var bool */ public $exists = true; public static function fromArray( array $a ): self { $u = new self(); $u->id = (int) $a['id']; $u->login = isset( $a['login'] ) ? (string) $a['login'] : ''; $u->registered = isset( $a['registered'] ) ? (string) $a['registered'] : ''; $u->capabilities = isset( $a['capabilities'] ) && is_array( $a['capabilities'] ) ? $a['capabilities'] : array(); $u->isSuperAdmin = ! empty( $a['isSuperAdmin'] ); $u->exists = isset( $a['exists'] ) ? (bool) $a['exists'] : true; return $u; } public function toArray(): array { return array( 'id' => $this->id, 'login' => $this->login, 'registered' => $this->registered, 'capabilities' => $this->capabilities, 'isSuperAdmin' => $this->isSuperAdmin, 'exists' => $this->exists, ); } }