Progression   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 32
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
getEntityInformations() 0 1 ?
retreiveField() 0 1 ?
A raids() 0 5 1
A raidById() 0 4 1
A raidByName() 0 4 1
A extratRaid() 0 9 1
1
<?php namespace GameScan\WoW\Entity\Player;
2
3
trait Progression
4
{
5
6
    abstract public function getEntityInformations();
7
    abstract public function retreiveField($fielName);
8
9
    public function raids()
10
    {
11
        $this->retreiveField("progression");
12
        return $this->getEntityInformations()->progression->raids;
13
    }
14
15
    public function raidById($id)
16
    {
17
        return $this->extratRaid("id", $id);
18
    }
19
20
    public function raidByName($name)
21
    {
22
        return $this->extratRaid("name", $name);
23
    }
24
25
    protected function extratRaid($key, $value)
26
    {
27
        $raids = $this->raids();
28
        $raid = array_filter($raids, function ($raid) use ($key, $value) {
29
            return $raid->{$key} === $value;
30
        });
31
32
        return array_shift($raid);
33
    }
34
}
35