Base   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 16
lcom 1
cbo 1
dl 0
loc 89
ccs 0
cts 65
cp 0
rs 10
c 0
b 0
f 0

19 Methods

Rating   Name   Duplication   Size   Complexity  
getEntityInformations() 0 1 ?
getHost() 0 1 ?
getRegion() 0 1 ?
getApiRequest() 0 1 ?
A getLastModified() 0 4 1
A name() 0 4 1
A realm() 0 4 1
A playerClass() 0 4 1
A playerClassName() 0 7 2
A race() 0 4 1
A gender() 0 4 1
A level() 0 4 1
A achievementPoints() 0 4 1
A thumbnail() 0 4 1
A calcClass() 0 4 1
A totalHonorableKills() 0 4 1
A getAvatarUrl() 0 6 1
A getProfileMainUrl() 0 4 1
A getInsetUrl() 0 4 1
1
<?php namespace GameScan\WoW\Entity\Player;
2
3
trait Base
4
{
5
    abstract public function getEntityInformations();
6
    abstract public function getHost();
7
    abstract public function getRegion();
8
    abstract protected function getApiRequest();
9
10
    public function getLastModified()
11
    {
12
        return $this->getEntityInformations()->lastInformation;
13
    }
14
15
    public function name()
16
    {
17
        return $this->getEntityInformations()->name;
18
    }
19
20
    public function realm()
21
    {
22
        return $this->getEntityInformations()->realm;
23
    }
24
25
    public function playerClass()
26
    {
27
        return $this->getEntityInformations()->class;
28
    }
29
    
30
    public function playerClassName(array $className = null)
31
    {
32
        if ($className === null) {
33
            $className = (new \GameScan\WoW\Entity\CharacterClass($this->getApiRequest()))->getClassesName();
34
        }
35
        return $className[$this->playerClass()];
36
    }
37
38
    public function race()
39
    {
40
        return $this->getEntityInformations()->race;
41
    }
42
43
    public function gender()
44
    {
45
        return $this->getEntityInformations()->gender;
46
    }
47
48
    public function level()
49
    {
50
        return $this->getEntityInformations()->level;
51
    }
52
53
    public function achievementPoints()
54
    {
55
        return $this->getEntityInformations()->achievementPoints;
56
    }
57
58
59
    public function thumbnail()
60
    {
61
        return $this->getEntityInformations()->thumbnail;
62
    }
63
64
    public function calcClass()
65
    {
66
        return $this->getEntityInformations()->calcClass;
67
    }
68
69
    public function totalHonorableKills()
70
    {
71
        return $this->getEntityInformations()->totalHonorableKills;
72
    }
73
74
    public function getAvatarUrl()
75
    {
76
        $host = str_replace(".api", '', $this->getHost());
77
        $region = $this->getRegion();
78
        return $host . "static-render/" . $region . "/" . $this->thumbnail();
79
    }
80
81
    public function getProfileMainUrl()
82
    {
83
        return str_replace("avatar", "profilemain", $this->getAvatarUrl());
84
    }
85
86
87
    public function getInsetUrl()
88
    {
89
        return str_replace("avatar", "inset", $this->getAvatarUrl());
90
    }
91
}
92