Credentials   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 25
rs 10
c 0
b 0
f 0
ccs 12
cts 12
cp 1
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getUsername() 0 3 1
A getPassword() 0 3 1
A __construct() 0 10 3
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of the package neoblack/free-at-home-api.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE file that was distributed with this source code.
9
 */
10
11
namespace NeoBlack\FreeAtHomeApi\Entity;
12
13
use NeoBlack\FreeAtHomeApi\Exception\CredentialsException;
14
15
class Credentials
16
{
17
    protected $username;
18
    protected $password;
19
20 5
    public function __construct(string $username, string $password)
21
    {
22 5
        if ($username === '') {
23 2
            throw new CredentialsException('username is required', 1536353801);
24
        }
25 3
        if ($password === '') {
26 1
            throw new CredentialsException('password is required', 1536353831);
27
        }
28 2
        $this->username = $username;
29 2
        $this->password = $password;
30 2
    }
31
32 1
    public function getUsername(): string
33
    {
34 1
        return $this->username;
35
    }
36
37 1
    public function getPassword(): string
38
    {
39 1
        return $this->password;
40
    }
41
}
42