AwsPinpointSmsMessage   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A create() 0 4 1
A setBody() 0 6 1
A setMessageType() 0 6 1
A setRecipients() 0 18 4
1
<?php
2
3
namespace NotificationChannels\AwsPinpoint;
4
5
class AwsPinpointSmsMessage
6
{
7
    public $body;
8
    public $messageType = 'TRANSACTIONAL';
9
    public $recipients;
10
    public $senderId;
11
12 8
    public function __construct($body = '')
13
    {
14 8
        if (! empty($body)) {
15 2
            $this->body = trim($body);
16
        }
17 8
    }
18
19 1
    public static function create($body = '')
20
    {
21 1
        return new static($body);
22
    }
23
24 1
    public function setBody($body)
25
    {
26 1
        $this->body = trim($body);
27
28 1
        return $this;
29
    }
30
31 1
    public function setMessageType($type)
32
    {
33 1
        $this->messageType = $type;
34
35 1
        return $this;
36
    }
37
38 3
    public function setRecipients($recipients)
39
    {
40 3
        if (is_string($recipients) === true || is_int($recipients) === true) {
41 2
            $recipients = [$recipients];
42
        }
43
44 3
        $output = [];
45
46 3
        foreach ($recipients as $number) {
47 3
            $output[$number] = [
48
                'ChannelType' => 'SMS',
49
            ];
50
        }
51
52 3
        $this->recipients = $output;
53
54 3
        return $this;
55
    }
56
}
57