Refactor readers for better di (#457)
* Refactor readers to get a proper DI Similar to what was done with writers, readers also needed to be updated to match the new way of doing things. This commits promotes a better DI (factories, injection through constructors). * Escapers should not be singletons Instead, they should be proper object that can be injected where needed.
This commit is contained in:
1 parent
4d6437fa77
commit
b7e46740ce
66 files changed
+1095
-618
No files matched your search
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Common\Creator;
|
||||
|
||||
use Box\Spout\Common\Helper\EncodingHelper;
|
||||
use Box\Spout\Common\Helper\FileSystemHelper;
|
||||
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
|
||||
|
||||
/**
|
||||
* Class HelperFactory
|
||||
* Factory to create helpers
|
||||
*
|
||||
* @package Box\Spout\Common\Creator
|
||||
*/
|
||||
class HelperFactory
|
||||
{
|
||||
/**
|
||||
* @return GlobalFunctionsHelper
|
||||
*/
|
||||
public function createGlobalFunctionsHelper()
|
||||
{
|
||||
return new GlobalFunctionsHelper();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseFolderPath The path of the base folder where all the I/O can occur
|
||||
* @return FileSystemHelper
|
||||
*/
|
||||
public function createFileSystemHelper($baseFolderPath)
|
||||
{
|
||||
return new FileSystemHelper($baseFolderPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GlobalFunctionsHelper $globalFunctionsHelper
|
||||
* @return EncodingHelper
|
||||
*/
|
||||
public function createEncodingHelper(GlobalFunctionsHelper $globalFunctionsHelper)
|
||||
{
|
||||
return new EncodingHelper($globalFunctionsHelper);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user