AuthenticationTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A realm() 0 6 1
1
<?php
2
3
namespace Psr7Middlewares\Utils;
4
5
/**
6
 * Utilities used by authentication middlewares.
7
 */
8
trait AuthenticationTrait
9
{
10
    private $users;
11
    private $realm = 'Login';
12
13
    /**
14
     * Defines de users.
15
     *
16
     * @param array $users [username => password]
17
     */
18
    public function __construct(array $users)
19
    {
20
        $this->users = $users;
21
    }
22
23
    /**
24
     * Set the realm value.
25
     *
26
     * @param string $realm
27
     *
28
     * @return self
29
     */
30
    public function realm($realm)
31
    {
32
        $this->realm = $realm;
33
34
        return $this;
35
    }
36
}
37