Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
AdapterUserTrait
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 setUsernameField
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 setPasswordField
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getUsernameField
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getPasswordField
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Auth;
16
17/**
18 * Adapter field trait
19 *
20 * @category   Pop
21 * @package    Pop\Auth
22 * @author     Nick Sagona, III <nick@popphp.org>
23 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
24 * @license    https://www.popphp.org/license     New BSD License
25 * @version    5.0.0
26 */
27trait AdapterUserTrait
28{
29
30    /**
31     * Username field
32     * @var string
33     */
34    protected string $usernameField = 'username';
35
36    /**
37     * Password field
38     * @var string
39     */
40    protected string $passwordField = 'password';
41
42    /**
43     * User data
44     * @var mixed
45     */
46    protected mixed $user = null;
47
48    /**
49     * Set the username field
50     *
51     * @param  string $usernameField
52     * @return static
53     */
54    public function setUsernameField(string $usernameField): static
55    {
56        $this->usernameField = $usernameField;
57        return $this;
58    }
59
60    /**
61     * Set the password field
62     *
63     * @param  string $passwordField
64     * @return static
65     */
66    public function setPasswordField(string $passwordField): static
67    {
68        $this->passwordField = $passwordField;
69        return $this;
70    }
71
72    /**
73     * Get the username field
74     *
75     * @return string
76     */
77    public function getUsernameField(): string
78    {
79        return $this->usernameField;
80    }
81
82    /**
83     * Get the password field
84     *
85     * @return string
86     */
87    public function getPasswordField(): string
88    {
89        return $this->passwordField;
90    }
91
92    /**
93     * Get the user record
94     *
95     * @return mixed
96     */
97    public function getUser(): mixed
98    {
99        return $this->user;
100    }
101
102}