| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace CBOR\OtherObject; |
| 6 | |
| 7 | use CBOR\OtherObject as Base; |
| 8 | use InvalidArgumentException; |
| 9 | use function ord; |
| 10 | |
| 11 | final class GenericObject extends Base |
| 12 | { |
| 13 | public static function supportedAdditionalInformation(): array |
| 14 | { |
| 15 | return []; |
| 16 | } |
| 17 | |
| 18 | public static function createFromLoadedData(int $additionalInformation, ?string $data): Base |
| 19 | { |
| 20 | if ($data !== null && ord($data) < 32) { |
| 21 | throw new InvalidArgumentException('Invalid simple value. Content data should not be present.'); |
| 22 | } |
| 23 | |
| 24 | return new self($additionalInformation, $data); |
| 25 | } |
| 26 | } |