GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 7392fc...b66279 )
by Gregorio
04:48 queued 02:32
created

TwilioSmsMessage   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 108
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
lcom 5
cbo 1
dl 0
loc 108
ccs 21
cts 21
cp 1
rs 10
c 1
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getFrom() 0 10 4
A sender() 0 6 1
A applicationSid() 0 6 1
A maxPrice() 0 6 1
A provideFeedback() 0 6 1
A validityPeriod() 0 6 1
1
<?php
2
3
namespace NotificationChannels\Twilio;
4
5
class TwilioSmsMessage extends TwilioMessage
6
{
7
    /**
8
     * @var null|string
9
     */
10
    public $alphaNumSender = null;
11
12
    /**
13
     * @var null|string
14
     */
15
    public $applicationSid = null;
16
17
    /**
18
     * @var null|float
19
     */
20
    public $maxPrice = null;
21
22
    /**
23
     * @var null|bool
24
     */
25
    public $provideFeedback = null;
26
27
    /**
28
     * @var null|int
29
     */
30
    public $validityPeriod = null;
31
32
    /**
33
     * Get the from address of this message.
34
     *
35
     * @return null|string
36
     */
37 12
    public function getFrom()
38
    {
39 12
        if ($this->from) {
40 4
            return $this->from;
41
        }
42
43 8
        if ($this->alphaNumSender && strlen($this->alphaNumSender) > 0) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->alphaNumSender of type null|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
44 2
            return $this->alphaNumSender;
45
        }
46 6
    }
47
48
    /**
49
     * Set the alphanumeric sender.
50
     *
51
     * @param string $sender
52
     * @return $this
53
     */
54 4
    public function sender($sender)
55
    {
56 4
        $this->alphaNumSender = $sender;
57
58 4
        return $this;
59
    }
60
61
    /**
62
     * Set application SID for the message status callback.
63
     *
64
     * @param string $applicationSid
65
     * @return $this
66
     */
67 4
    public function applicationSid($applicationSid)
68
    {
69 4
        $this->applicationSid = $applicationSid;
70
71 4
        return $this;
72
    }
73
74
    /**
75
     * Set the max price (in USD dollars).
76
     *
77
     * @param float $maxPrice
78
     * @return $this
79
     */
80 4
    public function maxPrice($maxPrice)
81
    {
82 4
        $this->maxPrice = $maxPrice;
83
84 4
        return $this;
85
    }
86
87
    /**
88
     * Set the provide feedback option.
89
     *
90
     * @param bool $provideFeedback
91
     * @return $this
92
     */
93 4
    public function provideFeedback($provideFeedback)
94
    {
95 4
        $this->provideFeedback = $provideFeedback;
96
97 4
        return $this;
98
    }
99
100
    /**
101
     * Set the validity period (in seconds).
102
     *
103
     * @param int $validityPeriod
104
     * @return $this
105
     */
106 4
    public function validityPeriod($validityPeriod)
107
    {
108 4
        $this->validityPeriod = $validityPeriod;
109
110 4
        return $this;
111
    }
112
}
113