Total Complexity | 7 |
Total Lines | 97 |
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 int |
||
23 | */ |
||
24 | protected $phone_number; |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $from; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $username; |
||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $password; |
||
38 | |||
39 | /** |
||
40 | * FortySixElksMedia constructor. |
||
41 | */ |
||
42 | public function __construct() |
||
43 | { |
||
44 | $this->username = config('services.46elks.username'); |
||
45 | $this->password = config('services.46elks.password'); |
||
46 | if (!$this->username || !$this->password) { |
||
47 | throw MissingConfigNotification::missingConfig(); |
||
48 | } |
||
49 | |||
50 | $this->client = new Client( |
||
|
|||
51 | [ |
||
52 | 'headers' => [ |
||
53 | 'Content-Type' => 'application/x-www-urlencoded', |
||
54 | ], |
||
55 | 'auth' => [ |
||
56 | $this->username, |
||
57 | $this->password, |
||
58 | ], |
||
59 | ] |
||
60 | ); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param $line |
||
65 | * |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function line($line) |
||
69 | { |
||
70 | $this->payload['lines'][] = $line; |
||
71 | |||
72 | return $this; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @param $phone_number |
||
77 | * |
||
78 | * @return $this |
||
79 | */ |
||
80 | public function to($phoneNumber) |
||
81 | { |
||
82 | $this->phone_number = $phoneNumber; |
||
83 | |||
84 | return $this; |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * @param $string |
||
89 | * |
||
90 | * @return $this |
||
91 | */ |
||
92 | public function from($string) |
||
93 | { |
||
94 | $this->from = $string; |
||
95 | |||
96 | return $this; |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getContent() |
||
105 | } |
||
106 | } |
||
107 |