Skip to content

Commit

Permalink
Reformat the method checkCredentials method for a single return
Browse files Browse the repository at this point in the history
  • Loading branch information
dmanners committed Jul 26, 2017
1 parent acc5353 commit 097fe08
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions setup/src/Magento/Setup/Model/PackagesAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function getCredentialBaseUrl()
*/
public function checkCredentials($token, $secretKey)
{
$response = ['success' => true];
$serviceUrl = $this->getPackagesJsonUrl();
$this->curlClient->setCredentials($token, $secretKey);
try {
Expand All @@ -107,13 +108,13 @@ public function checkCredentials($token, $secretKey)
$packagesInfo = $this->curlClient->getBody();
$directory = $this->filesystem->getDirectoryWrite(DirectoryList::COMPOSER_HOME);
$directory->writeFile(self::PATH_TO_PACKAGES_FILE, $packagesInfo);
return $this->serializer->serialize(['success' => true]);
} else {
return $this->serializer->serialize(['success' => false, 'message' => 'Bad credentials']);
$response = ['success' => false, 'message' => 'Bad credentials'];
}
} catch (\Exception $e) {
return $this->serializer->serialize(['success' => false, 'message' => $e->getMessage()]);
$response = ['success' => false, 'message' => $e->getMessage()];
}
return $this->serializer->serialize($response);
}

/**
Expand Down

0 comments on commit 097fe08

Please sign in to comment.