1 | <?php |
||
2 | |||
3 | namespace NotificationChannels\FortySixElks; |
||
4 | |||
5 | use GuzzleHttp\Client; |
||
6 | use NotificationChannels\FortySixElks\Exceptions\MissingConfigNotification; |
||
7 | |||
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 |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
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( |
||
0 ignored issues
–
show
It seems like
new GuzzleHttp\Client(ar...ame, $this->password))) of type GuzzleHttp\Client is incompatible with the declared type NotificationChannels\For...xElks\GuzzleHttp\Client of property $client .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
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() |
||
108 | { |
||
109 | return implode(PHP_EOL, $this->payload['lines']); |
||
110 | } |
||
111 | } |
||
112 |