4 * @see https://github.com/laminas/laminas-diactoros for the canonical source repository
5 * @copyright https://github.com/laminas/laminas-diactoros/blob/master/COPYRIGHT.md
6 * @license https://github.com/laminas/laminas-diactoros/blob/master/LICENSE.md New BSD License
9 declare(strict_types=1);
11 namespace Laminas\Diactoros\Exception;
14 use UnexpectedValueException;
16 class DeserializationException extends UnexpectedValueException implements ExceptionInterface
18 public static function forInvalidHeader() : self
20 throw new self('Invalid header detected');
23 public static function forInvalidHeaderContinuation() : self
25 throw new self('Invalid header continuation');
28 public static function forRequestFromArray(Throwable $previous) : self
30 return new self('Cannot deserialize request', $previous->getCode(), $previous);
33 public static function forResponseFromArray(Throwable $previous) : self
35 return new self('Cannot deserialize response', $previous->getCode(), $previous);
38 public static function forUnexpectedCarriageReturn() : self
40 throw new self('Unexpected carriage return detected');
43 public static function forUnexpectedEndOfHeaders() : self
45 throw new self('Unexpected end of headers');
48 public static function forUnexpectedLineFeed() : self
50 throw new self('Unexpected line feed detected');