• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daycry / auth / 22527357078

28 Feb 2026 07:22PM UTC coverage: 63.267% (+0.7%) from 62.568%
22527357078

push

github

daycry
Remove PHP 8.1 from PHPUnit CI matrix

Update .github/workflows/phpunit.yml to drop PHP 8.1 from the test matrix. CI will now run PHPUnit only on PHP 8.2 and 8.3, reducing the matrix to current supported versions.

3064 of 4843 relevant lines covered (63.27%)

41.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.0
/src/Exceptions/AuthenticationException.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Daycry Auth.
7
 *
8
 * (c) Daycry <daycry9@proton.me>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Daycry\Auth\Exceptions;
15

16
use CodeIgniter\Exceptions\RuntimeException;
17
use CodeIgniter\HTTP\Exceptions\HTTPException;
18

19
class AuthenticationException extends RuntimeException
20
{
21
    /**
22
     * Whether the request was authorised (i.e. credentials were structurally
23
     * valid).  Set to false only when a specific user was rejected.
24
     * Stored as an instance property to avoid the race condition that a
25
     * static property would introduce in concurrent requests.
26
     */
27
    public bool $authorized = true;
28

29
    /**
30
     * HTTP 401 Unauthorized — the request lacks valid authentication credentials.
31
     */
32
    protected $code = 401;
33

34
    /**
35
     * @param string $alias Authenticator alias
36
     */
37
    public static function forUnknownAuthenticator(string $alias): self
×
38
    {
39
        return new self(lang('Auth.unknownAuthenticator', [$alias]));
×
40
    }
41

42
    public static function forInvalidLibraryImplementation(): self
×
43
    {
44
        return new self(lang('Auth.invalidLibraryImplementation'));
×
45
    }
46

47
    public static function forUnknownUserProvider(): self
×
48
    {
49
        return new self(lang('Auth.unknownUserProvider'));
×
50
    }
51

52
    public static function forInvalidUser(): self
3✔
53
    {
54
        $e             = new self(lang('Auth.invalidUser'));
3✔
55
        $e->authorized = false;
3✔
56

57
        return $e;
3✔
58
    }
59

60
    public static function forBannedUser(): self
×
61
    {
62
        $e             = new self(lang('Auth.invalidUser'));
×
63
        $e->authorized = false;
×
64

65
        return $e;
×
66
    }
67

68
    public static function forNoEntityProvided(): self
×
69
    {
70
        return new self(lang('Auth.noUserEntity'), 500);
×
71
    }
72

73
    /**
74
     * Fires when no minimumPasswordLength has been set
75
     * in the Auth config file.
76
     */
77
    public static function forUnsetPasswordLength(): self
1✔
78
    {
79
        return new self(lang('Auth.unsetPasswordLength'), 500);
1✔
80
    }
81

82
    /**
83
     * When the cURL request (to Have I Been Pwned) in PwnedValidator
84
     * throws a HTTPException it is re-thrown as this one
85
     */
86
    public static function forHIBPCurlFail(HTTPException $e): self
×
87
    {
88
        return new self($e->getMessage(), $e->getCode(), $e);
×
89
    }
90
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc