* @copyright 2007-2020 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ /** * Class ColissimoMigration */ class ColissimoMigration { /** @var ColissimoOtherModuleInterface[] $otherModules */ private $otherModules; /** * @param ColissimoOtherModuleInterface $module */ public function addModule(ColissimoOtherModuleInterface $module) { $this->otherModules[] = $module; } /** * @param string $step * @throws Exception */ public function migrate($step) { $methodCall = Tools::toCamelCase('migrate_'.$step); foreach ($this->otherModules as $otherModule) { if (method_exists($otherModule, $methodCall)) { $otherModule->$methodCall(); } else { throw new Exception('Cannot call migration step.'); } } } }