primo commit
This commit is contained in:
46
libraries/vendor/laminas/laminas-diactoros/src/Exception/DeserializationException.php
vendored
Normal file
46
libraries/vendor/laminas/laminas-diactoros/src/Exception/DeserializationException.php
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use Throwable;
|
||||
use UnexpectedValueException;
|
||||
|
||||
class DeserializationException extends UnexpectedValueException implements ExceptionInterface
|
||||
{
|
||||
public static function forInvalidHeader(): self
|
||||
{
|
||||
throw new self('Invalid header detected');
|
||||
}
|
||||
|
||||
public static function forInvalidHeaderContinuation(): self
|
||||
{
|
||||
throw new self('Invalid header continuation');
|
||||
}
|
||||
|
||||
public static function forRequestFromArray(Throwable $previous): self
|
||||
{
|
||||
return new self('Cannot deserialize request', $previous->getCode(), $previous);
|
||||
}
|
||||
|
||||
public static function forResponseFromArray(Throwable $previous): self
|
||||
{
|
||||
return new self('Cannot deserialize response', $previous->getCode(), $previous);
|
||||
}
|
||||
|
||||
public static function forUnexpectedCarriageReturn(): self
|
||||
{
|
||||
throw new self('Unexpected carriage return detected');
|
||||
}
|
||||
|
||||
public static function forUnexpectedEndOfHeaders(): self
|
||||
{
|
||||
throw new self('Unexpected end of headers');
|
||||
}
|
||||
|
||||
public static function forUnexpectedLineFeed(): self
|
||||
{
|
||||
throw new self('Unexpected line feed detected');
|
||||
}
|
||||
}
|
||||
14
libraries/vendor/laminas/laminas-diactoros/src/Exception/ExceptionInterface.php
vendored
Normal file
14
libraries/vendor/laminas/laminas-diactoros/src/Exception/ExceptionInterface.php
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Marker interface for package-specific exceptions.
|
||||
*/
|
||||
interface ExceptionInterface extends Throwable
|
||||
{
|
||||
}
|
||||
9
libraries/vendor/laminas/laminas-diactoros/src/Exception/InvalidArgumentException.php
vendored
Normal file
9
libraries/vendor/laminas/laminas-diactoros/src/Exception/InvalidArgumentException.php
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
28
libraries/vendor/laminas/laminas-diactoros/src/Exception/InvalidForwardedHeaderNameException.php
vendored
Normal file
28
libraries/vendor/laminas/laminas-diactoros/src/Exception/InvalidForwardedHeaderNameException.php
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders;
|
||||
|
||||
use function gettype;
|
||||
use function is_object;
|
||||
use function is_string;
|
||||
use function sprintf;
|
||||
|
||||
class InvalidForwardedHeaderNameException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function forHeader(mixed $name): self
|
||||
{
|
||||
if (! is_string($name)) {
|
||||
$name = sprintf('(value of type %s)', is_object($name) ? $name::class : gettype($name));
|
||||
}
|
||||
|
||||
return new self(sprintf(
|
||||
'Invalid X-Forwarded-* header name "%s" provided to %s',
|
||||
$name,
|
||||
FilterUsingXForwardedHeaders::class
|
||||
));
|
||||
}
|
||||
}
|
||||
32
libraries/vendor/laminas/laminas-diactoros/src/Exception/InvalidProxyAddressException.php
vendored
Normal file
32
libraries/vendor/laminas/laminas-diactoros/src/Exception/InvalidProxyAddressException.php
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use function gettype;
|
||||
use function is_object;
|
||||
use function sprintf;
|
||||
|
||||
class InvalidProxyAddressException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function forInvalidProxyArgument(mixed $proxy): self
|
||||
{
|
||||
$type = is_object($proxy) ? $proxy::class : gettype($proxy);
|
||||
return new self(sprintf(
|
||||
'Invalid proxy of type "%s" provided;'
|
||||
. ' must be a valid IPv4 or IPv6 address, optionally with a subnet mask provided'
|
||||
. ' or an array of such values',
|
||||
$type,
|
||||
));
|
||||
}
|
||||
|
||||
public static function forAddress(string $address): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'Invalid proxy address "%s" provided;'
|
||||
. ' must be a valid IPv4 or IPv6 address, optionally with a subnet mask provided',
|
||||
$address,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
||||
class InvalidStreamPointerPositionException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
/** {@inheritDoc} */
|
||||
public function __construct(
|
||||
string $message = 'Invalid pointer position',
|
||||
int $code = 0,
|
||||
?Throwable $previous = null
|
||||
) {
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
9
libraries/vendor/laminas/laminas-diactoros/src/Exception/RuntimeException.php
vendored
Normal file
9
libraries/vendor/laminas/laminas-diactoros/src/Exception/RuntimeException.php
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
20
libraries/vendor/laminas/laminas-diactoros/src/Exception/SerializationException.php
vendored
Normal file
20
libraries/vendor/laminas/laminas-diactoros/src/Exception/SerializationException.php
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use UnexpectedValueException;
|
||||
|
||||
class SerializationException extends UnexpectedValueException implements ExceptionInterface
|
||||
{
|
||||
public static function forInvalidRequestLine(): self
|
||||
{
|
||||
return new self('Invalid request line detected');
|
||||
}
|
||||
|
||||
public static function forInvalidStatusLine(): self
|
||||
{
|
||||
return new self('No status line detected');
|
||||
}
|
||||
}
|
||||
30
libraries/vendor/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php
vendored
Normal file
30
libraries/vendor/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class UnreadableStreamException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function dueToConfiguration(): self
|
||||
{
|
||||
return new self('Stream is not readable');
|
||||
}
|
||||
|
||||
public static function dueToMissingResource(): self
|
||||
{
|
||||
return new self('No resource available; cannot read');
|
||||
}
|
||||
|
||||
public static function dueToPhpError(): self
|
||||
{
|
||||
return new self('Error reading stream');
|
||||
}
|
||||
|
||||
public static function forCallbackStream(): self
|
||||
{
|
||||
return new self('Callback streams cannot read');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use UnexpectedValueException;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
class UnrecognizedProtocolVersionException extends UnexpectedValueException implements ExceptionInterface
|
||||
{
|
||||
public static function forVersion(string $version): self
|
||||
{
|
||||
return new self(sprintf('Unrecognized protocol version (%s)', $version));
|
||||
}
|
||||
}
|
||||
15
libraries/vendor/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php
vendored
Normal file
15
libraries/vendor/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class UnrewindableStreamException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function forCallbackStream(): self
|
||||
{
|
||||
return new self('Callback streams cannot rewind position');
|
||||
}
|
||||
}
|
||||
30
libraries/vendor/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php
vendored
Normal file
30
libraries/vendor/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class UnseekableStreamException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function dueToConfiguration(): self
|
||||
{
|
||||
return new self('Stream is not seekable');
|
||||
}
|
||||
|
||||
public static function dueToMissingResource(): self
|
||||
{
|
||||
return new self('No resource available; cannot seek position');
|
||||
}
|
||||
|
||||
public static function dueToPhpError(): self
|
||||
{
|
||||
return new self('Error seeking within stream');
|
||||
}
|
||||
|
||||
public static function forCallbackStream(): self
|
||||
{
|
||||
return new self('Callback streams cannot seek position');
|
||||
}
|
||||
}
|
||||
25
libraries/vendor/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php
vendored
Normal file
25
libraries/vendor/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class UntellableStreamException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function dueToMissingResource(): self
|
||||
{
|
||||
return new self('No resource available; cannot tell position');
|
||||
}
|
||||
|
||||
public static function dueToPhpError(): self
|
||||
{
|
||||
return new self('Error occurred during tell operation');
|
||||
}
|
||||
|
||||
public static function forCallbackStream(): self
|
||||
{
|
||||
return new self('Callback streams cannot tell position');
|
||||
}
|
||||
}
|
||||
30
libraries/vendor/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php
vendored
Normal file
30
libraries/vendor/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class UnwritableStreamException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function dueToConfiguration(): self
|
||||
{
|
||||
return new self('Stream is not writable');
|
||||
}
|
||||
|
||||
public static function dueToMissingResource(): self
|
||||
{
|
||||
return new self('No resource available; cannot write');
|
||||
}
|
||||
|
||||
public static function dueToPhpError(): self
|
||||
{
|
||||
return new self('Error writing to stream');
|
||||
}
|
||||
|
||||
public static function forCallbackStream(): self
|
||||
{
|
||||
return new self('Callback streams cannot write');
|
||||
}
|
||||
}
|
||||
20
libraries/vendor/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php
vendored
Normal file
20
libraries/vendor/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
||||
class UploadedFileAlreadyMovedException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
/** {@inheritDoc} */
|
||||
public function __construct(
|
||||
string $message = 'Cannot retrieve stream after it has already moved',
|
||||
int $code = 0,
|
||||
?Throwable $previous = null
|
||||
) {
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
38
libraries/vendor/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php
vendored
Normal file
38
libraries/vendor/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Diactoros\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
class UploadedFileErrorException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
public static function forUnmovableFile(): self
|
||||
{
|
||||
return new self('Error occurred while moving uploaded file');
|
||||
}
|
||||
|
||||
public static function dueToStreamUploadError(string $error): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'Cannot retrieve stream due to upload error: %s',
|
||||
$error
|
||||
));
|
||||
}
|
||||
|
||||
public static function dueToUnwritablePath(): self
|
||||
{
|
||||
return new self('Unable to write to designated path');
|
||||
}
|
||||
|
||||
public static function dueToUnwritableTarget(string $targetDirectory): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'The target directory `%s` does not exist or is not writable',
|
||||
$targetDirectory
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user