Rename and add session update methods
This commit is contained in:
parent
a9a13f186c
commit
cd7be1c3b2
5 changed files with 58 additions and 21 deletions
|
@ -10,6 +10,7 @@ use Socialbox\Objects\Database\RegisteredPeerRecord;
|
|||
class SelfUser implements SerializableInterface
|
||||
{
|
||||
private string $uuid;
|
||||
private bool $enabled;
|
||||
private string $address;
|
||||
private string $username;
|
||||
private ?string $displayName;
|
||||
|
@ -29,8 +30,9 @@ class SelfUser implements SerializableInterface
|
|||
if($data instanceof RegisteredPeerRecord)
|
||||
{
|
||||
$this->uuid = $data->getUuid();
|
||||
$this->enabled = $data->isEnabled();
|
||||
$this->username = $data->getUsername();
|
||||
$this->address =
|
||||
$this->address = $data->getAddress();
|
||||
$this->displayName = $data->getDisplayName();
|
||||
$this->flags = $data->getFlags();
|
||||
$this->created = $data->getCreated()->getTimestamp();
|
||||
|
@ -39,7 +41,9 @@ class SelfUser implements SerializableInterface
|
|||
}
|
||||
|
||||
$this->uuid = $data['uuid'];
|
||||
$this->enabled = $data['enabled'];
|
||||
$this->username = $data['username'];
|
||||
$this->address = $data['address'];
|
||||
$this->displayName = $data['display_name'] ?? null;
|
||||
|
||||
if(is_string($data['flags']))
|
||||
|
@ -77,6 +81,11 @@ class SelfUser implements SerializableInterface
|
|||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string The username of the user.
|
||||
|
@ -86,6 +95,11 @@ class SelfUser implements SerializableInterface
|
|||
return $this->username;
|
||||
}
|
||||
|
||||
public function getAddress(): string
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string|null The display name.
|
||||
|
@ -104,15 +118,6 @@ class SelfUser implements SerializableInterface
|
|||
return $this->flags;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return int The timestamp when the object was created.
|
||||
|
@ -143,7 +148,9 @@ class SelfUser implements SerializableInterface
|
|||
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'enabled' => $this->enabled,
|
||||
'username' => $this->username,
|
||||
'address' => $this->address,
|
||||
'display_name' => $this->displayName,
|
||||
'flags' => $flags,
|
||||
'created' => $this->created
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue