Skip to content

Commit

Permalink
Update GenerateSitemap.php
Browse files Browse the repository at this point in the history
Code improvement.
  • Loading branch information
tajveez-73 authored Jun 9, 2021
1 parent 6c14f9a commit d11c5cd
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Cron/GenerateSitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Vendic\VueStorefrontSitemap\Model\ProductCollection;
use Vendic\VueStorefrontSitemap\Model\SitemapFactory;
use Magento\Framework\Filesystem\Driver\File;
use Magento\Framework\Filesystem\Io\File as Io;

class GenerateSitemap
{
Expand Down Expand Up @@ -51,28 +50,21 @@ class GenerateSitemap
* @var File
*/
protected $fileDriver;
/**
* @var Io
*/
protected $io;

public function __construct(
CategoryCollection $categoryCollection,
Configuration $configuration,
ProductCollection $productCollection,
DirectoryList $directoryList,
SitemapFactory $sitemapFactory,
File $fileDriver,
Io $io
File $fileDriver
) {
$this->directoryList = $directoryList;
$this->sitemapFactory = $sitemapFactory;
$this->productCollection = $productCollection;
$this->configuration = $configuration;
$this->categoryCollection = $categoryCollection;
$this->fileDriver = $fileDriver;
$this->io = $io;

$this->fileDriver = $fileDriver;
}

public function execute() : void
Expand All @@ -82,7 +74,7 @@ public function execute() : void
$path = $this->getPubPath();

// Create directory at Path if doesn't exists
if (!$this->fileDriver->isExists($path)) $this->io->mkdir($path, 0775);
if (!$this->fileDriver->isDirectory($path)) $this->fileDriver->createDirectory($path, 0775);

// Sitemap configuration
$this->sitemap = $this->sitemapFactory->create($domain);
Expand Down

0 comments on commit d11c5cd

Please sign in to comment.