Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Agent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 is
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace LambdaTwelve\OneRecord\Server\Spi;
6
7use LambdaTwelve\OneRecord\Rdf\Iri;
8
9/**
10 * An authenticated caller: the logistics agent (an Organization URI on the
11 * ONE Record network) the request acts as, plus who vouched for it and what
12 * else the credential said, for access policies that need more.
13 */
14final readonly class Agent
15{
16    /**
17     * @param array<string, mixed> $claims
18     */
19    public function __construct(
20        public Iri $iri,
21        public ?string $issuer = null,
22        public array $claims = [],
23    ) {}
24
25    public function is(Iri|string $other): bool
26    {
27        return $this->iri->value === ($other instanceof Iri ? $other->value : $other);
28    }
29}