diff --git a/Application/Model/Registries/registry_abstract.php b/Application/Model/Registries/registry_abstract.php new file mode 100644 index 0000000..b8f8e6c --- /dev/null +++ b/Application/Model/Registries/registry_abstract.php @@ -0,0 +1,63 @@ + + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Application\Model\Registries; + +use D3\PdfDocuments\Application\Model\Interfaces\pdfdocuments_generic_interface; + +abstract class registry_abstract implements registry_generic_interface +{ + protected $_aRegistry = array(); + + /** + * @param $className * generator fully qualified class name + * @param pdfdocuments_generic_interface $item + */ + protected function addItem($className, pdfdocuments_generic_interface $item) + { + $this->_aRegistry[$className] = $item; + } + + /** + * @param $className * generator fully qualified class name + */ + public function removeGenerator($className) + { + // TODO: Implement removeGenerator() method. + } + + /** + * @param $className * generator fully qualified class name + */ + public function hasGenerator($className) + { + // TODO: Implement hasGenerator() method. + } + + /** + * @return array + */ + public function getList() + { + return $this->_aRegistry; + } + + public function clearList() + { + // TODO: Implement clearList() method. + } +} \ No newline at end of file diff --git a/Application/Model/Registries/registry_generic_interface.php b/Application/Model/Registries/registry_generic_interface.php new file mode 100644 index 0000000..f009e68 --- /dev/null +++ b/Application/Model/Registries/registry_generic_interface.php @@ -0,0 +1,43 @@ + + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Application\Model\Registries; + +interface registry_generic_interface +{ + /** + * @param $className * generator fully qualified class name + */ + public function removeGenerator($className); + + /** + * @param $className * generator fully qualified class name + */ + public function hasGenerator($className); + + /** + * @param $className * generator fully qualified class name + */ + public function getGenerator($className); + + /** + * @return array + */ + public function getList(); + + public function clearList(); +} \ No newline at end of file diff --git a/Application/Model/Registries/registry_orderoverview.php b/Application/Model/Registries/registry_orderoverview.php new file mode 100644 index 0000000..a1065a2 --- /dev/null +++ b/Application/Model/Registries/registry_orderoverview.php @@ -0,0 +1,53 @@ + + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Application\Model\Registries; + +use D3\PdfDocuments\Application\Model\Documents\deliverynotePdf; +use D3\PdfDocuments\Application\Model\Documents\deliverynotewithoutlogoPdf; +use D3\PdfDocuments\Application\Model\Documents\invoicePdf; +use D3\PdfDocuments\Application\Model\Documents\invoicewithoutlogoPdf; +use D3\PdfDocuments\Application\Model\Interfaces\pdfdocuments_order_interface; + +class registry_orderoverview extends registry_abstract implements registry_orderoverview_interface +{ + public function __construct() + { + $this->addGenerator(invoicePdf::class, oxNew(invoicePdf::class)); + $this->addGenerator(deliverynotePdf::class, oxNew(deliverynotePdf::class)); + $this->addGenerator(invoicewithoutlogoPdf::class, oxNew(invoicewithoutlogoPdf::class)); + $this->addGenerator(deliverynotewithoutlogoPdf::class, oxNew(deliverynotewithoutlogoPdf::class)); + } + + /** + * @param $className + * @param pdfdocuments_order_interface $pdfGenerator + */ + public function addGenerator($className, pdfdocuments_order_interface $pdfGenerator) + { + $this->addItem($className, $pdfGenerator); + } + + /** + * @param $className * generator fully qualified class name + * @return pdfdocuments_order_interface + */ + public function getGenerator($className) + { + return $this->_aRegistry[$className]; + } +} \ No newline at end of file diff --git a/Application/Model/Registries/registry_orderoverview_interface.php b/Application/Model/Registries/registry_orderoverview_interface.php new file mode 100644 index 0000000..4c8ea01 --- /dev/null +++ b/Application/Model/Registries/registry_orderoverview_interface.php @@ -0,0 +1,29 @@ + + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Application\Model\Registries; + +use D3\PdfDocuments\Application\Model\Interfaces\pdfdocuments_order_interface; + +interface registry_orderoverview_interface extends registry_generic_interface +{ + /** + * @param $className * generator fully qualified class name + * @param pdfdocuments_order_interface $pdfGenerator + */ + public function addGenerator($className, pdfdocuments_order_interface $pdfGenerator); +} \ No newline at end of file