Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** |
| 6 | * This file is part of php-fast-forward/http-message. |
| 7 | * |
| 8 | * This source file is subject to the license bundled |
| 9 | * with this source code in the file LICENSE. |
| 10 | * |
| 11 | * @link https://github.com/php-fast-forward/http-message |
| 12 | * @copyright Copyright (c) 2025 Felipe Sayão Lobato Abreu <github@mentordosnerds.com> |
| 13 | * @license https://opensource.org/licenses/MIT MIT License |
| 14 | */ |
| 15 | |
| 16 | namespace FastForward\Http\Message; |
| 17 | |
| 18 | /** |
| 19 | * Interface PayloadAwareInterface. |
| 20 | * |
| 21 | * Defines functionality for objects that encapsulate and manage a payload. |
| 22 | * Implementations of this interface MUST provide immutable methods for accessing and replacing the payload. |
| 23 | * The payload MAY be of any type supported by the implementation, including arrays, objects, scalars, or null. |
| 24 | * |
| 25 | * @package FastForward\Http\Message |
| 26 | * |
| 27 | * @internal |
| 28 | */ |
| 29 | interface PayloadImmutableInterface |
| 30 | { |
| 31 | /** |
| 32 | * Returns a new instance with the specified payload. |
| 33 | * |
| 34 | * This method MUST NOT modify the current instance. It SHALL return a new instance with the updated payload. |
| 35 | * The payload MAY be of any type supported by the implementation. Implementations MAY throw exceptions if |
| 36 | * constraints on the payload type are violated. |
| 37 | * |
| 38 | * @param mixed $payload the new payload to set in the instance |
| 39 | * |
| 40 | * @return self a new instance with the updated payload |
| 41 | */ |
| 42 | public function withPayload(mixed $payload): self; |
| 43 | } |