Test Failed
Pull Request — master (#2)
by Talha Zekeriya
19:57 queued 09:46
created

NetGsmMessage   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 15
c 1
b 0
f 0
dl 0
loc 56
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setBody() 0 5 1
A setHeader() 0 5 1
A create() 0 3 1
A setRecipients() 0 8 2
A __construct() 0 4 2
1
<?php
2
3
namespace NotificationChannels\NetGsm;
4
5
class NetGsmMessage
6
{
7
    public $body = '';
8
    public $header = null;
9
    public $recipients = [];
10
11
    /**
12
     * @param  string  $body
13
     * @return self
14
     */
15
    public static function create($body = '')
16
    {
17
        return new static($body);
18
    }
19
20
    public function __construct($body = '')
21
    {
22
        if (! empty($body)) {
23
            $this->body = trim($body);
24
        }
25
    }
26
27
    /**
28
     * @param string $body
29
     * @return self
30
     */
31
    public function setBody($body)
32
    {
33
        $this->body = trim($body);
34
35
        return $this;
36
    }
37
38
    /**
39
     * @param $header
40
     * @return self
41
     */
42
    public function setHeader($header)
43
    {
44
        $this->header = $header;
45
46
        return $this;
47
    }
48
49
    /**
50
     * @param string|array $recipients
51
     * @return self
52
     */
53
    public function setRecipients($recipients)
54
    {
55
        if (! is_array($recipients)) {
56
            $recipients = [$recipients];
57
        }
58
        $this->recipients = $recipients;
59
60
        return $this;
61
    }
62
}
63