Completed
Push — master ( 2f57a2...d63f8e )
by Christian
02:21
created

Verb::getModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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\Doctrine\Mapping;
13
14
use Xabbuh\XApi\Model\Verb as VerbModel;
15
16
/**
17
 * A {@link Verb} mapped to a storage backend.
18
 *
19
 * @author Christian Flothmann <[email protected]>
20
 */
21
class Verb
22
{
23
    public $identifier;
24
    public $id;
25
    public $display;
26
27
    public function getModel()
28
    {
29
        return new VerbModel($this->id, $this->display);
30
    }
31
32
    public function equals(Verb $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 fromModel(VerbModel $verb)
50
    {
51
        $mappedVerb = new self();
52
        $mappedVerb->id = $verb->getId();
53
        $mappedVerb->display = $verb->getDisplay();
54
55
        return $mappedVerb;
56
    }
57
}
58