- md5
- 7d191239fe42666e8fc1a13dd9a8b291
- sha1
- ca6a3b184e8949de1e8f81d1296ccb63b817ccb3
- sha256
- 077be26657e4a2b48c9b0e2ee7a0a2000b2b7fa296c74427b439a0831ab6e303
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
<?php
declare(strict_types=1);
namespace SpomkyLabs\Pki\X509\AttributeCertificate\Validation;
use DateTimeImmutable;
use Psr\Clock\ClockInterface;
use SpomkyLabs\Pki\X509\Certificate\Extension\Target\Target;
use SpomkyLabs\Pki\X509\CertificationPath\CertificationPath;
/**
* Provides configuration context for the attribute certificate validation.
*/
final class ACValidationConfig
{
/**
* Evaluation reference time.
*/
private DateTimeImmutable $evalTime;
/**
* Permitted targets.
*
* @var Target[]
*/
private array $targets;
/**
* @param CertificationPath $holderPath Certification path of the AC holder
* @param CertificationPath $issuerPath Certification path of the AC issuer
*/
private function __construct(
private readonly CertificationPath $holderPath,
private readonly CertificationPath $issuerPath,
?ClockInterface $clock = null,
) {
$this->evalTime = $clock !== null ? $clock->now() : new DateTimeImmutable();
$this->targets = [];
}
public static function create(
CertificationPath $holderPath,
CertificationPath $issuerPath,
?ClockInterface $clock = null,
): self {
return new self($holderPath, $issuerPath, $clock);
}
/**
* Get certification path of the AC's holder.
*/
public function holderPath(): CertificationPath
{
return $this->holderPath;
}
/**
* Get certification path of the AC's issuer.
*/
public function issuerPath(): CertificationPath
{
return $this->issuerPath;
}
/**
* Get self with given evaluation reference time.
*/
public function withEvaluationTime(DateTimeImmutable $dt): self
{
$obj = clone $this;
$obj->evalTime = $dt;
return $obj;
}
/**
* Get the evaluation reference time.
*/
public function evaluationTime(): DateTimeImmutable
{
return $this->evalTime;
}
/**
* Get self with permitted targets.
*/
public function withTargets(Target ...$targets): self
{
$obj = clone $this;
$obj->targets = $targets;
return $obj;
}
/**
* Get array of permitted targets.
*
* @return Target[]
*/
public function targets(): array
{
return $this->targets;
}
}
The same content is in 11 releases, Joomla 6.2.0-alpha2 to 6.3.0-alpha1. See them all, or every version of this file.