Random DI improvements (#458)

* Add random DI improvements

Fixing things that were previously missed

* Split InternalFactory into Manager and Helper factories
This commit is contained in:
Adrien Loison authored and GitHub committed 2017-08-27 01:44:20 +02:00
1 parent b7e46740ce
commit 4ec3a21170
19 files changed
+317 -183

No files matched your search

+14 -1
View File
@@ -2,6 +2,8 @@
namespace Box\Spout\Writer\Common\Helper;
use Box\Spout\Writer\Common\Creator\EntityFactory;
/**
* Class ZipHelper
* This class provides helper functions to create zip files
@@ -16,6 +18,17 @@ class ZipHelper
const EXISTING_FILES_SKIP = 'skip';
const EXISTING_FILES_OVERWRITE = 'overwrite';
/** @var EntityFactory Factory to create entities */
private $entityFactory;
/**
* @param EntityFactory $entityFactory Factory to create entities
*/
public function __construct($entityFactory)
{
$this->entityFactory = $entityFactory;
}
/**
* Returns a new ZipArchive instance pointing at the given path.
*
@@ -24,7 +37,7 @@ class ZipHelper
*/
public function createZip($tmpFolderPath)
{
$zip = new \ZipArchive();
$zip = $this->entityFactory->createZipArchive();
$zipFilePath = $tmpFolderPath . self::ZIP_EXTENSION;
$zip->open($zipFilePath, \ZipArchive::CREATE|\ZipArchive::OVERWRITE);