Completed
Push — master ( 49f631...00219d )
by Frank
03:48
created

Credentials   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 27
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
A getUsername() 0 4 1
A getPassword() 0 4 1
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