Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
AuthAttemptLog
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Modules\User\Domain\Model;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * Immutable value object representing authentication attempt audit parameters.
13 *
14 * @package App\Modules\User\Domain\Model
15 */
16final readonly class AuthAttemptLog
17{
18    /**
19     * AuthAttemptLog constructor.
20     *
21     * @param int|null    $userId          User ID if identified, null otherwise.
22     * @param bool        $status          True for successful login, false for failure.
23     * @param int         $failureReason   Failure code from AuthFailureReason.
24     * @param string      $ipAddress       Client IP address.
25     * @param string|null $userAgent       Client User-Agent string.
26     * @param string|null $httpProtocol    HTTP protocol version.
27     * @param string|null $requestId       Request correlation UUID.
28     * @param string|null $loginIdentifier Login/username attempted.
29     */
30    public function __construct(
31        public ?int $userId,
32        public bool $status,
33        public int $failureReason,
34        public string $ipAddress,
35        public ?string $userAgent = null,
36        public ?string $httpProtocol = null,
37        public ?string $requestId = null,
38        public ?string $loginIdentifier = null,
39        public string $userType = 'administrator',
40    ) {
41    }
42}