OrgMember   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 52
ccs 10
cts 10
cp 1
rs 10
c 2
b 0
f 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A profile() 0 10 3
1
<?php
2
3
namespace StarCitizen\Models;
4
5
use StarCitizen\Accounts\Accounts;
6
7
/**
8
 * Class OrgMember
9
 *
10
 * @package StarCitizen\Models
11
 *
12
 * @property Profile $profile
13
 */
14
class OrgMember extends Model
15
{
16
    /**
17
     * Member vars
18
     */
19
    public $sid;
20
    public $handle;
21
    public $rank;
22
    public $stars;
23
    public $roles;
24
    public $type;
25
    public $visibility;
26
27
    /**
28
     * @var array
29
     */
30
    protected $magicProperties = [
31
        'profile'
32
    ];
33
34
    /**
35
     * @var Profile
36
     */
37
    private $profile;
38
39
40
    /**
41
     * OrgMember constructor.
42
     *
43
     * @param array $memberData
44
     */
45 3
    public function __construct(array $memberData)
46
    {
47 3
        foreach ($memberData as $key => $value) {
48 3
            $this->$key = $value;
49
        }
50 3
    }
51
52
    /**
53
     * @return Profile
54
     */
55 1
    final protected function profile()
56
    {
57 1
        if ($this->profile === null) {
58 1
            $profile = Accounts::findProfile($this->handle);
59 1
            if ($profile instanceof Profile)
60 1
                $this->profile = $profile;
61
        }
62
63 1
        return $this->profile;
64
    }
65
}