Skip to content

Commit bdd0064

Browse files
authored
Merge pull request #21 from prajapati-kaushik/0000-fix-dsn-undefined-port-key
fix: dsn undefined port key #0000
2 parents 9f0777d + a08d0e8 commit bdd0064

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/Client.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ class Client implements MessageSenderInterface
1212
private $password;
1313
private $transportAccount;
1414
private $templateNamePrefix = '';
15-
private $toAddressOverride = null;
15+
private $toAddressOverride;
1616

1717
public function __construct(
1818
$username,
1919
$password,
2020
$apiUrl,
2121
$account,
2222
$library,
23-
$transportAccount = null
23+
$transportAccount = null,
2424
) {
2525
$this->username = $username;
2626
$this->password = $password;
@@ -38,7 +38,7 @@ public static function fromDsn($dsn): Client
3838
}
3939

4040
$part = parse_url($dsn);
41-
$port = $part['port'] ? ':'.$part['port'] : '';
41+
$port = isset($part['port']) ? ':'.$part['port'] : '';
4242

4343
$username = $part['user'];
4444
$password = $part['pass'];
@@ -139,7 +139,7 @@ public function getMessages()
139139
}
140140
$content = (string) $body;
141141
$data = json_decode($content, true);
142-
//print_r($data);
142+
// print_r($data);
143143

144144
/*
145145
// This return object //
@@ -251,7 +251,7 @@ public function addProperty($contactId, $fieldId, $value)
251251
]);
252252
}
253253

254-
//---------------------------- -----------------------------
254+
// ---------------------------- -----------------------------
255255
// ------------ Message convert to Object-------------------
256256
private function arrayToMessage($m)
257257
{
@@ -279,7 +279,7 @@ private function arrayToMessage($m)
279279
$t = $m['template'];
280280
$template = new Template();
281281
$template->setId($t['id']);
282-
//$template->setUuid($m['template']['uuid']);
282+
// $template->setUuid($m['template']['uuid']);
283283
$template->setCode($t['code']);
284284
$template->setUser($t['user']);
285285
$template->setStatus($t['status']);
@@ -318,27 +318,27 @@ private function arrayToMessage($m)
318318
private function parseAddresses($addresses)
319319
{
320320
if (!$addresses) {
321-
return array();
321+
return [];
322322
}
323323
if (is_string($addresses)) {
324324
// old format json string, parse to array
325325
if ('[' != $addresses[0]) {
326326
// Expecting a json array, assuming single address
327327
$address = new Address();
328-
//todo: parse in id, uuid and type if set
328+
// todo: parse in id, uuid and type if set
329329
$address->setIdentifier($addresses);
330330
$address->setName('');
331331
$address->setType('email');
332332

333-
return array($address);
333+
return [$address];
334334
}
335335
$addresses = json_decode($addresses, true);
336336
}
337337

338-
$res = array();
338+
$res = [];
339339
foreach ($addresses as $a) {
340340
$address = new Address();
341-
//todo: parse in id, uuid and type if set
341+
// todo: parse in id, uuid and type if set
342342
$address->setIdentifier($a['identifier']);
343343
$address->setName($a['name']);
344344
$address->setType('email');

0 commit comments

Comments
 (0)