SMSDRDeleteCallbackRequest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 13
c 2
b 0
f 0
dl 0
loc 62
ccs 12
cts 14
cp 0.8571
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 3
A uri() 0 3 1
A method() 0 3 1
A options() 0 4 1
1
<?php
2
3
namespace Mediumart\Orange\SMS\Http\Requests;
4
5
use Exception;
6
use Mediumart\Orange\SMS\Http\SMSClientRequest;
7
8
class SMSDRDeleteCallbackRequest extends SMSClientRequest
9
{
10
    /**
11
     * @var string
12
     */
13
    private $id;
14
15
    /**
16
     * @var string
17
     */
18
    private $sender;
19
20
    /**
21
     * SMSDRDeleteCallbackRequest constructor.
22
     * @param $id
23
     * @param $sender
24
     * @throws \Exception
25
     */
26 1
    public function __construct($id, $sender)
27
    {
28 1
        if (! $sender) {
29
            throw new Exception('Missing sender address');
30
        }
31
32 1
        if (! $id) {
33
            throw new Exception('Missing subscription id');
34
        }
35
36 1
        $this->sender = 'tel:'.$this->normalizePhoneNumber($sender);
37
38 1
        $this->id = $id;
39 1
    }
40
41
    /**
42
     * Http request method.
43
     *
44
     * @return string
45
     */
46 1
    public function method()
47
    {
48 1
        return 'DELETE';
49
    }
50
51
    /**
52
     * The uri for the current request.
53
     *
54
     * @return string
55
     */
56 1
    public function uri()
57
    {
58 1
        return static::BASE_URI.'/smsmessaging/v1/outbound/'.urlencode($this->sender).'/subscriptions/'.$this->id;
59
    }
60
61
    /**
62
     * Http request options.
63
     *
64
     * @return array
65
     */
66 1
    public function options()
67
    {
68
        return [
69 1
            'headers' => ['Content-Type' => 'application/json']
70
        ];
71
    }
72
}
73