Initial xentral_oss_20.3.c9ffacf

This commit is contained in:
Alex
2021-05-21 08:49:41 +02:00
parent 5406e4a551
commit 34e5ac43d9
18884 changed files with 2109867 additions and 0 deletions
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Components\Http\Exception;
use RuntimeException;
class CsrfTokenException extends RuntimeException implements HttpComponentExceptionInterface
{
}
@@ -0,0 +1,7 @@
<?php
namespace Xentral\Components\Http\Exception;
class FileExistsException extends \RuntimeException implements HttpComponentExceptionInterface
{
}
@@ -0,0 +1,7 @@
<?php
namespace Xentral\Components\Http\Exception;
class FileNotFoundException extends \RuntimeException implements HttpComponentExceptionInterface
{
}
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Components\Http\Exception;
use Xentral\Core\Exception\ComponentExceptionInterface;
interface HttpComponentExceptionInterface extends ComponentExceptionInterface
{
}
@@ -0,0 +1,59 @@
<?php
namespace Xentral\Components\Http\Exception;
use RuntimeException;
use Throwable;
class HttpException extends RuntimeException implements HttpComponentExceptionInterface
{
/** @var int $statusCode */
protected $statusCode = 500;
/** @var array $errors */
protected $errors;
/**
* @param int $statusCode
* @param string $message
* @param int $code
* @param array $errors
* @param Throwable|null $previous
*/
public function __construct(
$statusCode = 500,
$message = '',
$code = 0,
Throwable $previous = null,
array $errors = []
) {
parent::__construct($message, $code, $previous);
$this->statusCode = $statusCode;
$this->errors = $errors;
}
/**
* @return int HTTP-Statuscode
*/
public function getStatusCode()
{
return $this->statusCode;
}
/**
* @return bool
*/
public function hasErrors()
{
return count($this->errors) > 0;
}
/**
* @return array
*/
public function getErrors()
{
return $this->errors;
}
}
@@ -0,0 +1,24 @@
<?php
namespace Xentral\Components\Http\Exception;
use RuntimeException;
use Throwable;
class HttpHeaderValueException extends RuntimeException implements HttpComponentExceptionInterface
{
public function __construct($message = '', $code = 0, Throwable $previous = null, $headerValue = null)
{
$headerString = '';
if ($headerValue === null) {
$headerString = 'null';
}
if (is_array($headerValue)) {
$headerString = sprintf('[%s]', implode(',', $headerValue));
}
$headerString = strval($headerString);
$message = sprintf('%s value:"%s"', $message, $headerString);
parent::__construct($message, $code, $previous);
}
}
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Components\Http\Exception;
use InvalidArgumentException as SplInvalidArgumentException;
class InvalidArgumentException extends SplInvalidArgumentException implements HttpComponentExceptionInterface
{
}
@@ -0,0 +1,21 @@
<?php
namespace Xentral\Components\Http\Exception;
use Throwable;
class MethodNotAllowedException extends HttpException
{
public function __construct(
array $allowedMethods,
$message = null,
$code = 0,
Throwable $previous = null
) {
if ($message === null) {
$message = sprintf('Method is not allowed. Allowed: %s', implode(', ', $allowedMethods));
}
parent::__construct(405, $message, $code, $previous);
}
}
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Components\Http\Exception;
use LogicException;
class NoUploadErrorException extends LogicException implements HttpComponentExceptionInterface
{
}
@@ -0,0 +1,7 @@
<?php
namespace Xentral\Components\Http\Exception;
class SessionException extends \RuntimeException implements HttpComponentExceptionInterface
{
}
@@ -0,0 +1,7 @@
<?php
namespace Xentral\Components\Http\Exception;
class SessionSegmentException extends \RuntimeException implements HttpComponentExceptionInterface
{
}