Account   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 45
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getHomePage() 0 4 1
A equals() 0 12 3
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