SMSCMessage::number()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Author: Facundo J Gonzalez
4
 * Date: 17/11/2017.
5
 */
6
7
namespace NotificationChannels\SMSC;
8
9
/**
10
 * Class SMSCMessage.
11
 */
12
final class SMSCMessage implements SMSCMessageInterface
13
{
14
    /**
15
     * The message content.
16
     *
17
     * @var string
18
     */
19
    private $content;
20
21
    /**
22
     * The number to be notified.
23
     *
24
     * @var string
25
     */
26
    private $number;
27
28
    /**
29
     * SMSCMessage constructor.
30
     *
31
     * @param string             $content
32
     * @param string             $number
33
     */
34
    public function __construct($content, $number)
35
    {
36
        $this->content = $content;
37
        $this->number = $number;
38
    }
39
40
    /**
41
     * Get the message properties as array.
42
     *
43
     * @return array
44
     */
45
    public function toArray()
46
    {
47
        return array_filter([
48
            'num' => $this->number(),
49
            'msj' => $this->content(),
50
        ]);
51
    }
52
53
    /**
54
     * Convert the sms message to sms parameters.
55
     *
56
     * @return array
57
     */
58
    public function toRequestParams()
59
    {
60
        return $this->toArray();
61
    }
62
63
    /**
64
     * Get the short message.
65
     *
66
     * @return string
67
     */
68
    public function content()
69
    {
70
        return $this->content;
71
    }
72
73
    /**
74
     * Get the to number.
75
     *
76
     * @return string
77
     */
78
    public function number()
79
    {
80
        return $this->number;
81
    }
82
83
    /**
84
     * Property getter.
85
     *
86
     * @param  string $name
87
     * @return mixed
88
     */
89
    public function __get($name)
90
    {
91
        return $this->$name();
92
    }
93
}
94