Skip to content
Snippets Groups Projects
Commit 40a07daa authored by Eddie Lau's avatar Eddie Lau
Browse files

MAGETWO-50516: Contribute Ogre Bugfixes and Stories for Sprint 46

 - fixed code mess
parent 9344b3a8
No related merge requests found
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
namespace Magento\Setup\Model; namespace Magento\Setup\Model;
use Zend\ServiceManager\ServiceLocatorInterface;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Filesystem;
use Zend\View\Model\JsonModel;
class MarketplaceManager class MarketplaceManager
{ {
/** /**
...@@ -81,7 +76,7 @@ class MarketplaceManager ...@@ -81,7 +76,7 @@ class MarketplaceManager
$this->composerInformation = $composerInformation; $this->composerInformation = $composerInformation;
$this->curlClient = $curl; $this->curlClient = $curl;
$this->filesystem = $filesystem; $this->filesystem = $filesystem;
$this->directory = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR); $this->directory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
} }
/** /**
...@@ -245,7 +240,8 @@ class MarketplaceManager ...@@ -245,7 +240,8 @@ class MarketplaceManager
*/ */
public function getAuthJson() public function getAuthJson()
{ {
$directory = $this->getFilesystem()->getDirectoryRead(DirectoryList::COMPOSER_HOME); $directory = $this->getFilesystem()
->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::COMPOSER_HOME);
if ($directory->isExist($this->pathToAuthFile) && $directory->isReadable($this->pathToAuthFile)) { if ($directory->isExist($this->pathToAuthFile) && $directory->isReadable($this->pathToAuthFile)) {
try { try {
$data = $directory->readFile($this->pathToAuthFile); $data = $directory->readFile($this->pathToAuthFile);
...@@ -265,7 +261,8 @@ class MarketplaceManager ...@@ -265,7 +261,8 @@ class MarketplaceManager
public function removeCredentials() public function removeCredentials()
{ {
$serviceUrl = $this->getCredentialBaseUrl(); $serviceUrl = $this->getCredentialBaseUrl();
$directory = $this->getFilesystem()->getDirectoryRead(DirectoryList::COMPOSER_HOME); $directory = $this->getFilesystem()
->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::COMPOSER_HOME);
if ($directory->isExist($this->pathToAuthFile) && $directory->isReadable($this->pathToAuthFile)) { if ($directory->isExist($this->pathToAuthFile) && $directory->isReadable($this->pathToAuthFile)) {
try { try {
$authJsonData = $this->getAuthJson(); $authJsonData = $this->getAuthJson();
...@@ -304,15 +301,17 @@ class MarketplaceManager ...@@ -304,15 +301,17 @@ class MarketplaceManager
] ]
] ]
]; ];
$json = new JsonModel($authContent); $json = new \Zend\View\Model\JsonModel($authContent);
$json->setOption('prettyPrint', true); $json->setOption('prettyPrint', true);
$jsonContent = $json->serialize(); $jsonContent = $json->serialize();
return $this->getDirectory()->writeFile( return $this->getDirectory()->writeFile(
DirectoryList::COMPOSER_HOME . DIRECTORY_SEPARATOR . $this->pathToAuthFile, \Magento\Framework\App\Filesystem\DirectoryList::COMPOSER_HOME .
DIRECTORY_SEPARATOR . $this->pathToAuthFile,
$jsonContent $jsonContent
) && $this->getDirectory()->changePermissions( ) && $this->getDirectory()->changePermissions(
DirectoryList::COMPOSER_HOME . DIRECTORY_SEPARATOR . $this->pathToAuthFile, \Magento\Framework\App\Filesystem\DirectoryList::COMPOSER_HOME .
DIRECTORY_SEPARATOR . $this->pathToAuthFile,
\Magento\Framework\Filesystem\DriverInterface::WRITEABLE_FILE_MODE \Magento\Framework\Filesystem\DriverInterface::WRITEABLE_FILE_MODE
); );
} }
...@@ -415,7 +414,7 @@ class MarketplaceManager ...@@ -415,7 +414,7 @@ class MarketplaceManager
} }
/** /**
* @return ServiceLocatorInterface * @return \Zend\ServiceManager\ServiceLocatorInterface
*/ */
public function getServiceLocator() public function getServiceLocator()
{ {
...@@ -447,7 +446,7 @@ class MarketplaceManager ...@@ -447,7 +446,7 @@ class MarketplaceManager
} }
/** /**
* @return Filesystem\Directory\Write|Filesystem\Directory\WriteInterface * @return \Magento\Framework\Filesystem\Directory\WriteInterface
*/ */
public function getDirectory() public function getDirectory()
{ {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment