Completed
Push — master ( c233b7...aa3611 )
by Christian
02:29
created

MappedVerb   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getModel() 0 4 1
A equals() 0 16 4
A createFromModel() 0 8 1
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 XApi\Repository\Api\Mapping;
13
14
use Xabbuh\XApi\Model\Verb;
15
16
/**
17
 * A {@link Verb} mapped to a storage backend.
18
 *
19
 * @author Christian Flothmann <[email protected]>
20
 */
21
class MappedVerb
22
{
23
    public $identifier;
24
    public $id;
25
    public $display;
26
27
    public function getModel()
28
    {
29
        return new Verb($this->id, $this->display);
30
    }
31
32
    public function equals(MappedVerb $verb)
33
    {
34
        if ($this->identifier !== $verb->identifier) {
35
            return false;
36
        }
37
38
        if ($this->id !== $verb->id) {
39
            return false;
40
        }
41
42
        if ($this->display !== $verb->display) {
43
            return false;
44
        }
45
46
        return true;
47
    }
48
49
    public static function createFromModel(Verb $verb)
50
    {
51
        $mappedVerb = new MappedVerb();
52
        $mappedVerb->id = $verb->getId();
53
        $mappedVerb->display = $verb->getDisplay();
54
55
        return $mappedVerb;
56
    }
57
}
58