<?php
namespace Platform\SecurityBundle\Entity\Profiles;
use Doctrine\ORM\Mapping as ORM;
/**
* Various things needed for an account at the system level.
*
* Class SystemProfile
* @package Platform\SecurityBundle\Entity\Profiles
*
* @ORM\Embeddable
*/
class SystemProfile
{
/**
* Name to display for the user.
* If none given, their email and/or account ID would be used in place of this.
*
* @var string|null
*
* @ORM\Column(
* type = "string",
* nullable = true,
* )
*/
protected ?string $displayName = null;
/**
*
* @var string|null
*
* @ORM\Column(
* type = "string",
* nullable = true,
* )
*/
protected ?string $firstName = null;
/**
*
* @var string|null
*
* @ORM\Column(
* type = "string",
* nullable = true,
* )
*/
protected ?string $lastName = null;
/**
* Whether this person has an avatar uploaded.
*
* @var bool
*
* @ORM\Column(
* type = "boolean",
* nullable = true,
* )
*/
protected ?bool $avatar = false;
/**
* Mobile phone for notification testing.
*
* @var string|null
*
* @ORM\Column(
* type = "string",
* nullable = true,
* )
*/
protected ?string $mobilePhone = null;
/**
* @return bool
*/
public function hasAvatar(): bool
{
return ($this->avatar === true);
}
/**
* @param bool $value
* @return $this
*/
public function setAvatar(bool $value): self
{
$this->avatar = ($value === true);
return $this;
}
/**
* @return string|null
*/
public function getDisplayName(): ?string
{
return $this->displayName;
}
/**
* @param string|null $displayName
* @return $this
*/
public function setDisplayName(?string $displayName): self
{
$this->displayName = $displayName ?: null;
return $this;
}
/**
* @return string|null
*/
public function getMobilePhone(): ?string
{
return $this->mobilePhone;
}
/**
* @param string|null $mobilePhone
* @return $this
*/
public function setMobilePhone(?string $mobilePhone): self
{
$this->mobilePhone = $mobilePhone ?: null;
return $this;
}
/**
* @return string
*/
public function getFirstName(): ?string
{
return $this->firstName;
}
/**
* @param string|null $firstName
* @return $this
*/
public function setFirstName(?string $firstName): self
{
$this->firstName = $firstName ?: null;
return $this;
}
/**
* @return string|null
*/
public function getLastName(): ?string
{
return $this->lastName;
}
/**
* @param string|null $lastName
* @return $this
*/
public function setLastName(?string $lastName): self
{
$this->lastName = $lastName ?: null;
return $this;
}
/**
* @return string|null
*/
public function getFullName(): ?string
{
if ($this->getFirstName() || $this->getLastName()) {
return trim(sprintf(
'%s %s',
$this->getFirstName(),
$this->getLastName(),
)) ?: null;
}
return null;
}
}