Skip to content

Commit b9c0281

Browse files
committed
fix exceptions
1 parent 3795f7d commit b9c0281

18 files changed

+30
-48
lines changed

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "daycry/restful",
33
"description": "Rest Server for Codeigniter 4",
4-
"homepage": "https://github.com/daycry/restfull",
4+
"homepage": "https://github.com/daycry/restful",
55
"authors":
66
[
77
{
@@ -19,7 +19,8 @@
1919
"daycry/jwt": "^1.0",
2020
"daycry/class-finder": "^2.0",
2121
"daycry/cronjob": "^2.0",
22-
"daycry/settings": "^1"
22+
"daycry/settings": "^1",
23+
"daycry/exceptions": "*"
2324
},
2425
"require-dev":
2526
{
@@ -79,6 +80,9 @@
7980
]
8081
},
8182
"config": {
83+
"optimize-autoloader": true,
84+
"preferred-install": "dist",
85+
"sort-packages": true,
8286
"allow-plugins": {
8387
"phpstan/extension-installer": true
8488
}

src/Auth.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace Daycry\RestFul;
66

7+
use Daycry\Exceptions\Interfaces\BaseExceptionInterface;
78
use Daycry\RestFul\Libraries\Authentication;
89
use Daycry\RestFul\Exceptions\AuthenticationException;
910
use Daycry\RestFul\Interfaces\AuthenticatorInterface;
1011
use Daycry\RestFul\Entities\User;
1112
use Daycry\RestFul\Models\UserModel;
12-
use Daycry\RestFul\Interfaces\BaseException;
1313

1414
/**
1515
* @method Result attempt(array $credentials)
@@ -144,7 +144,7 @@ public function __call(string $method, array $args)
144144
if ($authenticate && method_exists($authenticate, $method)) {
145145
return $authenticate->{$method}(...$args);
146146
}
147-
} catch(BaseException $ex) {
147+
} catch(BaseExceptionInterface $ex) {
148148
return false;
149149
}
150150
}

src/Authenticators/AccessToken.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Daycry\RestFul\Exceptions\AuthenticationException;
99
use Daycry\RestFul\Models\UserModel;
1010
use Daycry\RestFul\Models\UserIdentityModel;
11-
use CodeIgniter\Config\Services;
1211
use Daycry\RestFul\Entities\User;
1312

1413
class AccessToken extends Base implements AuthenticatorInterface

src/Exceptions/AuthenticationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Daycry\RestFul\Exceptions;
66

7-
use Daycry\RestFul\Exceptions\RuntimeException;
7+
use Daycry\Exceptions\Exceptions\RuntimeException;
88

99
class AuthenticationException extends RuntimeException
1010
{

src/Exceptions/AuthorizationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Daycry\RestFul\Exceptions;
66

7-
use Daycry\RestFul\Exceptions\RuntimeException;
7+
use Daycry\Exceptions\Exceptions\RuntimeException;
88

99
class AuthorizationException extends RuntimeException
1010
{

src/Exceptions/CorsException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Daycry\RestFul\Exceptions;
66

7-
use Daycry\RestFul\Exceptions\RuntimeException;
7+
use Daycry\Exceptions\Exceptions\RuntimeException;
88

99
class CorsException extends RuntimeException
1010
{

src/Exceptions/DatabaseException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Daycry\RestFul\Exceptions;
66

7+
use Daycry\Exceptions\Exceptions\RuntimeException;
8+
79
class DatabaseException extends RuntimeException
810
{
911
}

src/Exceptions/FailTooManyRequestsException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Daycry\RestFul\Exceptions;
44

5-
use Daycry\RestFul\Exceptions\RuntimeException;
5+
use Daycry\Exceptions\Exceptions\RuntimeException;
66

77
class FailTooManyRequestsException extends RuntimeException
88
{

src/Exceptions/ForbiddenException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Daycry\RestFul\Exceptions;
66

7-
use Daycry\RestFul\Exceptions\RuntimeException;
7+
use Daycry\Exceptions\Exceptions\RuntimeException;
88
use Config\Services;
99

1010
class ForbiddenException extends RuntimeException

src/Exceptions/LogicException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Daycry\RestFul\Exceptions;
66

7-
use Daycry\RestFul\Interfaces\BaseException;
7+
use Daycry\Exceptions\Interfaces\BaseExceptionInterface;
88

9-
class LogicException extends \LogicException implements BaseException
9+
class LogicException extends \LogicException implements BaseExceptionInterface
1010
{
1111
}

0 commit comments

Comments
 (0)