1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-07-30 21:00:13 +02:00

Move all exceptions and errors to separate files for autoloading

This commit is contained in:
Marco
2020-09-30 20:40:54 +02:00
parent cc6430a83e
commit 729c76668f
25 changed files with 233 additions and 57 deletions

View File

@@ -12,8 +12,6 @@ use Delight\Db\PdoDatabase;
use Delight\Db\PdoDsn;
use Delight\Db\Throwable\Error;
require_once __DIR__ . '/Exceptions.php';
/** Component that can be used for administrative tasks by privileged and authorized users */
final class Administration extends UserManager {

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class AmbiguousUsernameException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class AttemptCancelledException extends AuthException {}

View File

@@ -16,8 +16,6 @@ use Delight\Db\PdoDsn;
use Delight\Db\Throwable\Error;
use Delight\Db\Throwable\IntegrityConstraintViolationException;
require_once __DIR__ . '/Exceptions.php';
/** Component that provides all features and utilities for secure authentication of individual users */
final class Auth extends UserManager {

12
src/AuthError.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
/** Base class for all (unchecked) errors */
class AuthError extends \Exception {}

12
src/AuthException.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
/** Base class for all (checked) exceptions */
class AuthException extends \Exception {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class ConfirmationRequestNotFound extends AuthException {}

11
src/DatabaseError.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class DatabaseError extends AuthError {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class DuplicateUsernameException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class EmailNotVerifiedException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class EmailOrUsernameRequiredError extends AuthError {}

View File

@@ -1,51 +0,0 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class AuthException extends \Exception {}
class UnknownIdException extends AuthException {}
class InvalidEmailException extends AuthException {}
class UnknownUsernameException extends AuthException {}
class InvalidPasswordException extends AuthException {}
class EmailNotVerifiedException extends AuthException {}
class UserAlreadyExistsException extends AuthException {}
class NotLoggedInException extends AuthException {}
class InvalidSelectorTokenPairException extends AuthException {}
class TokenExpiredException extends AuthException {}
class TooManyRequestsException extends AuthException {}
class DuplicateUsernameException extends AuthException {}
class AmbiguousUsernameException extends AuthException {}
class AttemptCancelledException extends AuthException {}
class ResetDisabledException extends AuthException {}
class ConfirmationRequestNotFound extends AuthException {}
class AuthError extends \Exception {}
class DatabaseError extends AuthError {}
class MissingCallbackError extends AuthError {}
class HeadersAlreadySentError extends AuthError {}
class EmailOrUsernameRequiredError extends AuthError {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class HeadersAlreadySentError extends AuthError {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class InvalidEmailException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class InvalidPasswordException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class InvalidSelectorTokenPairException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class MissingCallbackError extends AuthError {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class NotLoggedInException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class ResetDisabledException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class TokenExpiredException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class TooManyRequestsException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class UnknownIdException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class UnknownUsernameException extends AuthException {}

View File

@@ -0,0 +1,11 @@
<?php
/*
* PHP-Auth (https://github.com/delight-im/PHP-Auth)
* Copyright (c) delight.im (https://www.delight.im/)
* Licensed under the MIT License (https://opensource.org/licenses/MIT)
*/
namespace Delight\Auth;
class UserAlreadyExistsException extends AuthException {}

View File

@@ -15,8 +15,6 @@ use Delight\Db\PdoDsn;
use Delight\Db\Throwable\Error;
use Delight\Db\Throwable\IntegrityConstraintViolationException;
require_once __DIR__ . '/Exceptions.php';
/**
* Abstract base class for components implementing user management
*