Profile   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 8
lcom 1
cbo 2
dl 0
loc 85
ccs 16
cts 16
cp 1
rs 10
c 3
b 0
f 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A threads() 0 10 3
A posts() 0 10 3
1
<?php
2
3
namespace StarCitizen\Models;
4
5
use StarCitizen\Accounts\Accounts;
6
7
/**
8
 * Class Profile
9
 *
10
 * @package StarCitizen\Models
11
 *
12
 * @property Store $threads
13
 * @property Store $posts
14
 */
15
class Profile extends Model
16
{
17
    /**
18
     * Profile vars
19
     */
20
    public $handle;
21
    public $citizen_number;
22
    public $status;
23
    public $moniker;
24
    public $avatar;
25
    public $enlisted;
26
    public $title;
27
    public $title_image;
28
    public $bio;
29
    public $website_link;
30
    public $website_title;
31
    public $country;
32
    public $region;
33
    public $fluenc;
34
    public $discussion_count;
35
    public $post_count;
36
    public $last_forum_visit;
37
    public $forum_roles;
38
    public $organizations;
39
    public $date_added;
40
    public $last_scrape_date;
41
42
    /**
43
     * @var array
44
     */
45
    protected $magicProperties = [
46
        'threads',
47
        'posts'
48
    ];
49
50
    /**
51
     * @var Store
52
     */
53
    private $threads;
54
55
    /**
56
     * @var Store
57
     */
58
    private $posts;
59
60
    /**
61
     * Profile constructor.
62
     *
63
     * @param $profileData
64
     */
65 6
    public function __construct($profileData)
66
    {
67 6
        foreach ($profileData as $key => $value) {
68 6
            $this->$key = $value;
69
        }
70 6
    }
71
72
    /**
73
     * @return Store
74
     */
75 2
    final protected function threads()
76
    {
77 2
        if ($this->threads === null) {
78 2
            $threads = Accounts::findThreads($this->handle);
79 2
            if ($threads instanceof Store)
80 2
                $this->threads = $threads;
81
        }
82
83 2
        return $this->threads;
84
    }
85
86
    /**
87
     * @return Store
88
     */
89 2
    final protected function posts()
90
    {
91 2
        if ($this->posts === null) {
92 2
            $posts = Accounts::findPosts($this->handle);
93 2
            if ($posts instanceof Store)
94 2
                $this->posts = $posts;
95
        }
96
97 2
        return $this->posts;
98
    }
99
}