SmsRuMessage::content()   A
last analyzed

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
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace NotificationChannels\SmsRu;
4
5
use Illuminate\Support\Arr;
6
7
class SmsRuMessage
8
{
9
    /**
10
     * The phone number the message should be sent from.
11
     *
12
     * @var string
13
     */
14
    public $from = '';
15
    /**
16
     * The message content.
17
     *
18
     * @var string
19
     */
20
    public $content = '';
21
22
    /**
23
     * Time of sending a message.
24
     *
25
     * @var int
26
     */
27
    public $time;
28
29
    /**
30
     * @var string
31
     */
32
    public $partnerId;
33
34
    /**
35
     * @var bool
36
     */
37
    public $test;
38
39
    /**
40
     * @var bool
41
     */
42
    public $translit;
43
44
    /**
45
     * Create a new message instance.
46
     *
47
     * @param  string $content
48
     *
49
     * @return static
50
     */
51
    public static function create($content = '')
52
    {
53
        return new static($content);
54
    }
55
    /**
56
     * @param  string  $content
57
     */
58
    public function __construct($content = '')
59
    {
60
        $this->content = $content;
61
    }
62
    /**
63
     * Set the message content.
64
     *
65
     * @param  string  $content
66
     *
67
     * @return $this
68
     */
69
    public function content($content)
70
    {
71
        $this->content = $content;
72
73
        return $this;
74
    }
75
76
    /**
77
     * Set the translit for SMS content.
78
     *
79
     * @param  string  $from
80
     *
81
     * @return $this
82
     */
83
    public function translit(bool $translit = false)
84
    {
85
        $this->translit = $translit;
86
87
        return $this;
88
    }
89
90
    /**
91
     * Set the test SMS - imitation sending.
92
     *
93
     * @param  string  $from
94
     *
95
     * @return $this
96
     */
97
    public function test(bool $test = false)
98
    {
99
        $this->test = $test;
100
101
        return $this;
102
    }
103
104
    /**
105
     * Set the test partner_id.
106
     *
107
     * @param  string  $from
108
     *
109
     * @return $this
110
     */
111
    public function partnerId($partnerId)
112
    {
113
        $this->partnerId = $partnerId;
114
115
        return $this;
116
    }
117
118
    /**
119
     * Set the phone number or sender name the message should be sent from.
120
     *
121
     * @param  string  $from
122
     *
123
     * @return $this
124
     */
125
    public function from($from)
126
    {
127
        $this->from = $from;
128
129
        return $this;
130
    }
131
132
    /**
133
     * Postpone shipping for -n- sec.
134
     *
135
     * @param null $time
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $time is correct as it would always require null to be passed?
Loading history...
136
     * @return $this
137
     */
138
    public function time(int $time = null)
139
    {
140
        $this->time = $time;
141
142
        return $this;
143
    }
144
}
145