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