Total Complexity | 7 |
Total Lines | 102 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class FortySixElksMedia |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | const ENDPOINT = null; |
||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $payload = [ |
||
18 | 'lines' => [], |
||
19 | ]; |
||
20 | |||
21 | /** |
||
22 | * @var GuzzleHttp\Client |
||
|
|||
23 | */ |
||
24 | protected $client; |
||
25 | |||
26 | /** |
||
27 | * @var int |
||
28 | */ |
||
29 | protected $phone_number; |
||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $from; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $username; |
||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $password; |
||
43 | |||
44 | /** |
||
45 | * FortySixElksMedia constructor. |
||
46 | */ |
||
47 | public function __construct() |
||
48 | { |
||
49 | $this->username = config('services.46elks.username'); |
||
50 | $this->password = config('services.46elks.password'); |
||
51 | if (!$this->username || !$this->password) { |
||
52 | throw MissingConfigNotification::missingConfig(); |
||
53 | } |
||
54 | |||
55 | $this->client = new Client( |
||
56 | [ |
||
57 | 'headers' => [ |
||
58 | 'Content-Type' => 'application/x-www-urlencoded', |
||
59 | ], |
||
60 | 'auth' => [ |
||
61 | $this->username, |
||
62 | $this->password, |
||
63 | ], |
||
64 | ] |
||
65 | ); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param $line |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function line($line) |
||
74 | { |
||
75 | $this->payload['lines'][] = $line; |
||
76 | |||
77 | return $this; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @param $phone_number |
||
82 | * |
||
83 | * @return $this |
||
84 | */ |
||
85 | public function to($phoneNumber) |
||
86 | { |
||
87 | $this->phone_number = $phoneNumber; |
||
88 | |||
89 | return $this; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @param $string |
||
94 | * |
||
95 | * @return $this |
||
96 | */ |
||
97 | public function from($string) |
||
98 | { |
||
99 | $this->from = $string; |
||
100 | |||
101 | return $this; |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * @return string |
||
106 | */ |
||
107 | public function getContent() |
||
110 | } |
||
111 | } |
||
112 |