TwitterDirectMessage   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getRecipient() 0 4 1
A __toString() 0 4 1
A create() 0 16 1
1
<?php
2
3
namespace Twitter\Object;
4
5
use Twitter\TwitterMessage;
6
use Twitter\TwitterMessageId;
7
8
class TwitterDirectMessage extends AbstractMessage implements TwitterMessage
9
{
10
    /**
11
     * @var TwitterUser
12
     */
13
    private $recipient;
14
15
    /**
16
     * Constructor.
17
     */
18 21
    public function __construct()
19
    {
20 21
    }
21
22
    /**
23
     * @return TwitterUser
24
     */
25 9
    public function getRecipient()
26
    {
27 9
        return $this->recipient;
28
    }
29
30
    /**
31
     * @return string
32
     */
33 3
    public function __toString()
34
    {
35 3
        return 'DM [' . $this->id . ']';
36
    }
37
38
    /**
39
     * Static constructor.
40
     *
41
     * @param TwitterMessageId   $id
42
     * @param TwitterUser        $recipient
43
     * @param TwitterUser        $sender
44
     * @param string             $text
45
     * @param \DateTimeInterface $createdAt
46
     * @param TwitterEntities    $entities
47
     *
48
     * @return TwitterDirectMessage
49
     */
50 21
    public static function create(
51
        TwitterMessageId $id,
52
        TwitterUser $sender,
53
        TwitterUser $recipient,
54
        $text,
55
        \DateTimeInterface $createdAt,
56
        TwitterEntities $entities
57
    ) {
58 21
        $obj = new self();
59
60 21
        $obj->init($id, $sender, $text, $entities, $createdAt);
61
62 21
        $obj->recipient = $recipient;
63
64 21
        return $obj;
65
    }
66
}
67