ToMany::send()   A
last analyzed

Complexity

Conditions 2
Paths 3

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 11
c 1
b 0
f 1
dl 0
loc 17
rs 9.9
cc 2
nc 3
nop 2
1
<?php
2
3
namespace MeysamZnd\HostiranSmsProvider;
4
5
use MeysamZnd\HostiranSmsProvider\Interfaces\Sms;
6
use SoapClient;
7
8
class ToMany implements Sms
9
{
10
    public function __construct()
11
    {
12
    }
13
14
    /**
15
     * @param string $url
16
     * @param array $data
17
     * @return array
18
     */
19
    public function send(string $url, array $data): array
20
    {
21
        ini_set('soap.wsdl_cache_enabled', '0');
22
        try {
23
            $client = new SoapClient($url, ['encoding' => 'UTF-8']);
24
            $response = [
25
                'status' => true,
26
                'providerResult' => $client->AddSchedule($data),
27
            ];
28
        } catch (\SoapFault $sf) {
29
            $response = [
30
                'status' => false,
31
                'providerResult' => $sf->getMessage(),
32
            ];
33
        }
34
35
        return $response;
36
    }
37
}
38