Added some helper methods

This commit is contained in:
Franck Allimant
2014-04-26 16:01:05 +02:00
parent ee820f1df7
commit d8c2f35446

View File

@@ -162,6 +162,34 @@ class Module extends BaseModule
return $this->getAbsoluteTemplateBasePath() .DS. $templateSubdirName; 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 * Calculate next position relative to module type
*/ */