Completed
Push — master ( bec1da...1f5bd4 )
by Tobias
04:49
created

Tag::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * Copyright (C) 2013 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\Model\Tag;
11
12
class Tag
13
{
14
    /**
15
     * @var string
16
     */
17
    private $tag;
18
19
    /**
20
     * @var string
21
     */
22
    private $description;
23
24
    /**
25
     * @var \DateTime
26
     */
27
    private $firstSeen;
28
29
    /**
30
     * @var \DateTime
31
     */
32
    private $lastSeen;
33
34
    /**
35
     * @param string    $tag
36
     * @param string    $description
37
     * @param \DateTime $firstSeen
38
     * @param \DateTime $lastSeen
39
     */
40 1
    public function __construct($tag, $description, \DateTime $firstSeen, \DateTime $lastSeen)
41
    {
42 1
        $this->tag = $tag;
43 1
        $this->description = $description;
44 1
        $this->firstSeen = $firstSeen;
45 1
        $this->lastSeen = $lastSeen;
46 1
    }
47
48
    /**
49
     * @param array $data
50
     *
51
     * @return Tag
52
     */
53 1
    public static function create(array $data)
54
    {
55 1
        return new self($data['tag'], $data['description'], new \DateTime($data['first-seen']), new \DateTime($data['last-seen']));
56
    }
57
58
    /**
59
     * @return string
60
     */
61 1
    public function getTag()
62
    {
63 1
        return $this->tag;
64
    }
65
66
    /**
67
     * @return string
68
     */
69 1
    public function getDescription()
70
    {
71 1
        return $this->description;
72
    }
73
74
    /**
75
     * @return \DateTime
76
     */
77 1
    public function getFirstSeen()
78
    {
79 1
        return $this->firstSeen;
80
    }
81
82
    /**
83
     * @return \DateTime
84
     */
85 1
    public function getLastSeen()
86
    {
87 1
        return $this->lastSeen;
88
    }
89
}
90