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

NetGsmMessage::setHeader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
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