mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-06 03:08:39 +00:00
fix minor construct bugs
This commit is contained in:
parent
6bcc6c2727
commit
9c9818b87c
|
|
@ -34,5 +34,6 @@ final class NullProfile extends Profile
|
|||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ class Profile implements \JsonSerializable
|
|||
/**
|
||||
* Birthday.
|
||||
*
|
||||
* @var \DateTime
|
||||
* @var null|\DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected \DateTime $birthday;
|
||||
protected ?\DateTime $birthday = null;
|
||||
|
||||
/**
|
||||
* Account.
|
||||
|
|
@ -90,7 +90,7 @@ class Profile implements \JsonSerializable
|
|||
{
|
||||
$this->image = new NullMedia();
|
||||
$this->birthday = new \DateTime('now');
|
||||
$this->account = $account ?? new Account();
|
||||
$this->account = $account ?? new NullAccount();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -212,13 +212,13 @@ class Profile implements \JsonSerializable
|
|||
/**
|
||||
* Set birthday.
|
||||
*
|
||||
* @param \DateTime $birthday Birthday
|
||||
* @param null|\DateTime $birthday Birthday
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setBirthday(\DateTime $birthday) : void
|
||||
public function setBirthday(?\DateTime $birthday) : void
|
||||
{
|
||||
$this->birthday = $birthday;
|
||||
}
|
||||
|
|
@ -226,11 +226,11 @@ class Profile implements \JsonSerializable
|
|||
/**
|
||||
* Get birthday.
|
||||
*
|
||||
* @return \DateTime
|
||||
* @return null|\DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getBirthday() : \DateTime
|
||||
public function getBirthday() : ?\DateTime
|
||||
{
|
||||
return $this->birthday;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ echo $this->getData('nav')->render();
|
|||
<td itemprop="jobTitle">Sailor
|
||||
<tr>
|
||||
<th><?= $this->getHtml('Birthday') ?>
|
||||
<td itemprop="birthDate" itemprop="foundingDate"><?= $profile->getBirthday()->format('Y-m-d'); ?>
|
||||
<td itemprop="birthDate" itemprop="foundingDate"><?= $profile->getBirthday() !== null ? $profile->getBirthday()->format('Y-m-d') : ''; ?>
|
||||
<tr>
|
||||
<th><?= $this->getHtml('Email') ?>
|
||||
<td itemprop="email"><a href="mailto:>donald.duck@email.com<"><?= $this->printHtml($account->getEmail()); ?></a>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user