Skip to content

Commit

Permalink
code refactor: nested condition -> guard clause; $response var initia…
Browse files Browse the repository at this point in the history
…lization to null
  • Loading branch information
sergey.lebedev committed Oct 14, 2019
1 parent a53dab2 commit 04a4b4a
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lib/classes/Swift/Transport/AbstractSmtpTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,20 331,23 @@ public function executeCommand($command, $codes = [], &$failures = null, $pipeli
}

$this->pipeline[] = [$command, $seq, $codes, $address];

if ($pipeline && $this->pipelining) {
$response = null;
} else {
while ($this->pipeline) {
list($command, $seq, $codes, $address) = array_shift($this->pipeline);
$response = $this->getFullResponse($seq);
try {
$this->assertResponseCode($response, $codes);
} catch (Swift_TransportException $e) {
if ($this->pipeline && $address) {
$failures[] = $address;
} else {
$this->throwException($e);
}
return null;
}

$response = null;

while ($this->pipeline) {
list($command, $seq, $codes, $address) = array_shift($this->pipeline);
$response = $this->getFullResponse($seq);
try {
$this->assertResponseCode($response, $codes);
} catch (Swift_TransportException $e) {
if ($this->pipeline && $address) {
$failures[] = $address;
} else {
$this->throwException($e);
}
}
}
Expand Down

0 comments on commit 04a4b4a

Please sign in to comment.