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

Credentials::getUsername()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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