Skip to content

Commit

Permalink
add expirationDate
Browse files Browse the repository at this point in the history
  • Loading branch information
Gwemox committed Jun 14, 2022
1 parent 12c1ea8 commit 4fe3eb1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Model/MatchingResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class MatchingResult
*/
protected $certificateInfo;

/**
* @var \DateTime|null
*/
protected $expirationDate;

public static function configureData(OptionsResolver $resolver)
{
$resolver
Expand All @@ -64,6 +69,13 @@ public static function configureData(OptionsResolver $resolver)
->setDefault('email', null)->setAllowedTypes('email', ['string', 'null'])
->setDefault('certificateLevel', null)->setAllowedTypes('certificateLevel', ['string', 'null'])
->setDefault('certificateStatus', null)->setAllowedTypes('certificateStatus', ['string', 'null'])
->setDefault('expirationDate', null)->setAllowedTypes('expirationDate', ['string', 'null', \DateTime::class])->setNormalizer('expirationDate', function(Options $options, $value) {
if (!is_string($value)) {
return $value;
}

return \DateTime::createFromFormat('Ymd\TH:i:s', $value, new \DateTimeZone('UTC'));
})
->setDefault('certificateInfo', null)->setAllowedTypes('certificateInfo', ['array', 'null', RaCertificateInfo::class])->setNormalizer('certificateInfo', function(Options $options, $value) {
if (null === $value || $value instanceof RaCertificateInfo) {
return $value;
Expand Down Expand Up @@ -100,6 +112,7 @@ public static function createFromArray(array $options): self
->setCertificateLevel($resolvedOptions['certificateLevel'])
->setCertificateStatus($resolvedOptions['certificateStatus'])
->setCertificateInfo($resolvedOptions['certificateInfo'])
->setExpirationDate($resolvedOptions['expirationDate'])
;
}

Expand Down Expand Up @@ -242,4 +255,24 @@ public function setCertificateInfo(?RaCertificateInfo $certificateInfo): self

return $this;
}

/**
* @return \DateTime|null
*/
public function getExpirationDate(): ?\DateTime
{
return $this->expirationDate;
}

/**
* @param \DateTime|null $expirationDate
*
* @return MatchingResult
*/
public function setExpirationDate(?\DateTime $expirationDate): self
{
$this->expirationDate = $expirationDate;

return $this;
}
}

0 comments on commit 4fe3eb1

Please sign in to comment.