Account   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 5
Bugs 0 Features 0
Metric Value
wmc 6
c 5
b 0
f 0
lcom 1
cbo 0
dl 0
loc 66
rs 10

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
    /**
22
     * The unique id or name used to log in to this account
23
     * @var string
24
     */
25
    private $name;
26
27
    /**
28
     * Canonical home page for the system the account is on
29
     * @var string
30
     */
31
    private $homePage;
32
33
    /**
34
     * @param string $name
35
     * @param string $homePage
36
     */
37
    public function __construct($name = '', $homePage = '')
38
    {
39
        $this->name = $name;
40
        $this->homePage = $homePage;
41
    }
42
43
    /**
44
     * Returns the unique id or name used to log in to this account.
45
     *
46
     * @return string The user name
47
     */
48
    public function getName()
49
    {
50
        return $this->name;
51
    }
52
53
    /**
54
     * Returns the home page for the system the account is on.
55
     *
56
     * @return string The home page
57
     */
58
    public function getHomePage()
59
    {
60
        return $this->homePage;
61
    }
62
63
    /**
64
     * Checks if another account is equal.
65
     *
66
     * Two accounts are equal if and only if all of their properties are equal.
67
     *
68
     * @param Account $account The account to compare with
69
     *
70
     * @return bool True if the accounts are equal, false otherwise
71
     */
72
    public function equals(Account $account)
73
    {
74
        if ($this->name !== $account->name) {
75
            return false;
76
        }
77
78
        if ($this->homePage !== $account->homePage) {
79
            return false;
80
        }
81
82
        return true;
83
    }
84
}
85