Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
HttpRequest
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
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
1<?php
2
3/**
4 * SPDX-License-Identifier: EUPL-1.2
5 *
6 * This file is part of icap-flow.
7 *
8 * Licensed under the EUPL, Version 1.2 only (the "Licence");
9 * you may not use this work except in compliance with the Licence.
10 * You may obtain a copy of the Licence at:
11 *
12 *     https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the Licence is distributed on an "AS IS" basis,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 */
18
19declare(strict_types=1);
20
21namespace Ndrstmr\Icap\DTO;
22
23/**
24 * Encapsulated HTTP request carried inside an ICAP REQMOD request
25 * (RFC 3507 §4.8). The {@see \Ndrstmr\Icap\RequestFormatter} renders its
26 * request-line + headers into the `req-hdr` section and streams the body
27 * into the `req-body` section.
28 */
29final readonly class HttpRequest
30{
31    /**
32     * @param string                  $method        HTTP method, e.g. "POST"
33     * @param string                  $requestTarget Request-target as per RFC 7230 §5.3 (path + optional query)
34     * @param array<string, string[]> $headers       HTTP header list
35     * @param resource|string|null    $body          HTTP body bytes, or a readable stream resource, or null for header-only
36     * @param string                  $httpVersion   HTTP version label, default HTTP/1.1
37     */
38    public function __construct(
39        public string $method,
40        public string $requestTarget = '/',
41        public array $headers = [],
42        public mixed $body = null,
43        public string $httpVersion = 'HTTP/1.1',
44    ) {
45    }
46}