/** * Runs the given class loader module pre-loading (load dependencies) and * perform an initial check on module (Interface implementation). * If this success return a new instance from the module, otherwise * a ModuleException will be thrown. * * @param string $moduleClassName * * @return \BuildR\ClassLoader\Modules\ClassLoaderModuleInterface * * @throws \BuildR\ClassLoader\Exception\ModuleException */ public function preLoad($moduleClassName) { $interfaces = class_implements($moduleClassName); if (!in_array(ClassLoaderModuleInterface::class, $interfaces)) { throw ModuleException::invalid($moduleClassName); } $module = new $moduleClassName(); return $module; }