Refactor writers for better DI (#427)
This commit is a big refactor that improves the code organization. It focuses on how dependencies are injected into the different classes. This is now done via some factories. Also, the code is now built around entities (data model that only exposes getters and setters), managers (used to manage an entity) and helpers (used by the managers to perform some specific tasks). The refactoring is not fully complete, as some dependencies are still hidden...
This commit is contained in:
1 parent
a366d0d0af
commit
bc17311f5f
37 files changed
+1529
-1031
No files matched your search
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Entity;
|
||||
|
||||
/**
|
||||
* Class Workbook
|
||||
* Entity describing a workbook
|
||||
*
|
||||
* @package Box\Spout\Writer\Entity
|
||||
*/
|
||||
class Workbook
|
||||
{
|
||||
/** @var Worksheet[] List of the workbook's sheets */
|
||||
private $worksheets = [];
|
||||
|
||||
/** @var string Timestamp based unique ID identifying the workbook */
|
||||
private $internalId;
|
||||
|
||||
/**
|
||||
* Workbook constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->internalId = uniqid();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Worksheet[]
|
||||
*/
|
||||
public function getWorksheets()
|
||||
{
|
||||
return $this->worksheets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Worksheet[] $worksheets
|
||||
*/
|
||||
public function setWorksheets($worksheets)
|
||||
{
|
||||
$this->worksheets = $worksheets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getInternalId()
|
||||
{
|
||||
return $this->internalId;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user