TelerivetApi::sendSmsRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 9.392
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
4
namespace Epmnzava\Telerivet\Api;
5
6
7
use Epmnzava\Telerivet\Models\SendSmsResponse;
8
9
class TelerivetApi
10
{
11
12
13
    public function sendSmsRequest(string $url,Array $data,$authorization)
0 ignored issues
show
Unused Code introduced by
The parameter $url is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    {
15
16
17
        $datacontent=$data["content"];
18
        $datato=$data["to"];
19
        $curl = curl_init();
20
21
        curl_setopt_array($curl, array(
22
            CURLOPT_URL => "https://api.telerivet.com/v1/projects/PJe7f3e7fe7d0ddf20/messages/send",
23
            CURLOPT_RETURNTRANSFER => true,
24
            CURLOPT_ENCODING => "",
25
            CURLOPT_MAXREDIRS => 10,
26
            CURLOPT_TIMEOUT => 30,
27
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
28
            CURLOPT_CUSTOMREQUEST => "POST",
29
            CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n$datacontent\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"to_number\"\r\n\r\n$datato\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
30
            CURLOPT_HTTPHEADER => array(
31
                "authorization: Basic ".$authorization,
32
                "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
33
            ),
34
        ));
35
36
37
        $response = curl_exec($curl);
38
        $err = curl_error($curl);
0 ignored issues
show
Unused Code introduced by
$err is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
39
40
        curl_close($curl);
41
42
43
        return  $response;
44
45
    }
46
47
}
48