Account::getHomePage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 1
cts 1
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\XApi\Model;
13
14
/**
15
 * A user account on an existing system.
16
 *
17
 * @author Christian Flothmann <[email protected]>
18
 */
19
final class Account
20
{
21
    private $name;
22
    private $homePage;
23
24
    public function __construct(string $name, IRL $homePage)
25
    {
26
        $this->name = $name;
27
        $this->homePage = $homePage;
28
    }
29
30
    /**
31
     * Returns the unique id or name used to log in to this account.
32
     */
33
    public function getName(): string
34
    {
35
        return $this->name;
36
    }
37 3
38
    /**
39 3
     * Returns the home page for the system the account is on.
40 3
     */
41 3
    public function getHomePage(): IRL
42
    {
43
        return $this->homePage;
44
    }
45
46
    /**
47
     * Checks if another account is equal.
48
     *
49
     * Two accounts are equal if and only if all of their properties are equal.
50
     */
51
    public function equals(Account $account): bool
52
    {
53
        if ($this->name !== $account->name) {
54
            return false;
55
        }
56
57
        if (!$this->homePage->equals($account->homePage)) {
58
            return false;
59
        }
60
61
        return true;
62
    }
63
}
64