diff --git a/core/lib/Thelia/Model/Module.php b/core/lib/Thelia/Model/Module.php index eba9b7fbb..7e43912dc 100644 --- a/core/lib/Thelia/Model/Module.php +++ b/core/lib/Thelia/Model/Module.php @@ -162,6 +162,34 @@ class Module extends BaseModule return $this->getAbsoluteTemplateBasePath() .DS. $templateSubdirName; } + /** + * @return true if this module is a delivery module + */ + public function isDeliveryModule() { + $moduleReflection = new \ReflectionClass($this->getFullNamespace()); + + return $moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface"); + } + + /** + * @return true if this module is a payment module + */ + public function isPayementModule() { + $moduleReflection = new \ReflectionClass($this->getFullNamespace()); + + return $moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface"); + } + + + /** + * @return BaseModule a new module instance. + */ + public function createInstance() { + $moduleClass = new \ReflectionClass($this->getFullNamespace()); + + return $moduleClass->newInstance(); + } + /** * Calculate next position relative to module type */