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
LogisticsObjectResponse
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
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
 isLatest
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace LambdaTwelve\OneRecord\Client;
6
7use DateTimeImmutable;
8use LambdaTwelve\OneRecord\Model\LogisticsObject;
9use LambdaTwelve\OneRecord\Spec\ApiVersion;
10
11/**
12 * What a server said about a logistics object: the headers the spec requires
13 * and, for GET, the object itself (null after HEAD).
14 */
15final readonly class LogisticsObjectResponse
16{
17    public function __construct(
18        public ?LogisticsObject $object,
19        public int $revision,
20        public int $latestRevision,
21        public ?DateTimeImmutable $lastModified,
22        public ?string $type,
23        public ApiVersion $apiVersion,
24    ) {}
25
26    public function isLatest(): bool
27    {
28        return $this->revision === $this->latestRevision;
29    }
30}