SMSCMessage   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 82
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toArray() 0 7 1
A toRequestParams() 0 4 1
A content() 0 4 1
A number() 0 4 1
A __get() 0 4 1
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