MP2Migrator = new \MailPoet\Config\MP2Migrator(); } /** * Import end point * * @param object $data * @return object */ public function import($data) { try { $process = $this->MP2Migrator->import(json_decode($data, true)); return $this->successResponse($process); } catch(\Exception $e) { return $this->errorResponse(array( $e->getCode() => $e->getMessage() )); } } /** * Stop import end point * * @param object $data * @return object */ public function stopImport($data) { try { $process = $this->MP2Migrator->stop_import(); return $this->successResponse($process); } catch(\Exception $e) { return $this->errorResponse(array( $e->getCode() => $e->getMessage() )); } } }