* @link http://www.oxidmodule.com */ namespace D3\DataWizard\Application\Model; class Configuration { const GROUP_CATEGORY = 'D3_DATAWIZARD_GROUP_CATEGORIES'; const GROUP_ARTICLES = 'D3_DATAWIZARD_GROUP_ARTICLES'; const GROUP_USERS = 'D3_DATAWIZARD_GROUP_USERS'; const GROUP_ORDERS = 'D3_DATAWIZARD_GROUP_ORDERS'; const GROUP_REMARKS = 'D3_DATAWIZARD_GROUP_REMARKS'; protected $exports = []; public function __construct() { $this->configure(); } public function configure() { } public function registerExport($group, ExportBase $export) { $this->exports[$group][md5(serialize($export))] = $export; } public function getGroupedExports() { return $this->exports; } public function getGroups() { return array_keys($this->exports); } public function getExportsByGroup($group) { return $this->exports[$group]; } /** * @return array */ public function getAllExports() : array { $all = []; foreach ($this->getGroups() as $group) { $all = array_merge($all, $this->getExportsByGroup($group)); } return $all; } /** * @param $id * * @return ExportBase */ public function getExportById($id) : ExportBase { return $this->getAllExports()[$id]; } }