TwitterDelete   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 96
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getDate() 0 4 1
A getId() 0 4 1
A getUserId() 0 4 1
A getType() 0 4 1
A __toString() 0 4 1
A create() 0 13 1
1
<?php
2
3
namespace Twitter\Object;
4
5
use Assert\Assertion;
6
use Twitter\TwitterDatedObject;
7
8
class TwitterDelete implements TwitterDatedObject
9
{
10
    const TWEET = 'tweet';
11
    const DM = 'direct message';
12
13
    /**
14
     * @var string
15
     */
16
    private $type;
17
18
    /**
19
     * @var int
20
     */
21
    private $id;
22
23
    /**
24
     * @var int
25
     */
26
    private $userId;
27
28
    /**
29
     * @var \DateTimeInterface
30
     */
31
    private $date;
32
33
    /**
34
     * Constructor.
35
     */
36 24
    public function __construct()
37
    {
38 24
    }
39
40
    /**
41
     * @return \DateTimeInterface
42
     */
43 15
    public function getDate()
44
    {
45 15
        return $this->date;
46
    }
47
48
    /**
49
     * @return int
50
     */
51 15
    public function getId()
52
    {
53 15
        return $this->id;
54
    }
55
56
    /**
57
     * @return int
58
     */
59 15
    public function getUserId()
60
    {
61 15
        return $this->userId;
62
    }
63
64
    /**
65
     * @return string
66
     */
67 15
    public function getType()
68
    {
69 15
        return $this->type;
70
    }
71
72
    /**
73
     * @return string
74
     */
75 3
    public function __toString()
76
    {
77 3
        return 'Deleted [' . $this->type . '][' . $this->id . ']';
78
    }
79
80
    /**
81
     * Static constructor.
82
     *
83
     * @param string             $type
84
     * @param int                $id
85
     * @param int                $userId
86
     * @param \DateTimeInterface $date
87
     *
88
     * @return TwitterDelete
89
     */
90 24
    public static function create($type, $id, $userId, \DateTimeInterface $date)
91
    {
92 24
        $obj = new self();
93
94 24
        Assertion::inArray($type, [ self::TWEET, self::DM ]);
95
96 24
        $obj->type = $type;
97 24
        $obj->id = $id;
98 24
        $obj->userId = $userId;
99 24
        $obj->date = $date;
100
101 24
        return $obj;
102
    }
103
}
104