getDiffResult($params); if ($result['empty']) { Logger::info("Identical resources"); } else { $templater = new Templater($params, $result['up'], $result['down']); $templater->output(); } Logger::success("Completed"); } catch (\Exception $e) { Logger::error($e->getMessage()); throw $e; } } /** * Compute the diff and return raw UP / DOWN SQL. * * This is the lower-level method used by DiffCommand so that the caller * can apply any output format (Flyway, Liquibase, Laravel, native…) rather * than being forced through the Templater. * * @param object $params A params object (DefaultParams-shaped stdClass or subclass). * @return array{empty: bool, up: string, down: string} */ public function getDiffResult(object $params): array { $diffCalculator = new DiffCalculator; $diff = $diffCalculator->getDiff($params); if (empty($diff['schema']) && empty($diff['data'])) { return ['empty' => true, 'up' => '', 'down' => '']; } $sqlGenerator = new SQLGenerator($diff); $up = ($params->include !== 'down') ? $sqlGenerator->getUp() : ''; $down = ($params->include !== 'up') ? $sqlGenerator->getDown() : ''; return ['empty' => false, 'up' => $up, 'down' => $down]; } }