src/DumpController.php
public function generateFile(TableSchema $table, $functionName, $tip = null, $indent = 0)
    {
        $params = $this->getParams($table, $functionName, $indent);

        if (
            empty($params['safeUp'])   ||
            empty($params['safeDown']) ||
            empty($params['className'])
        ) {
            return false;
        }

        $template = Yii::getAlias($this->templateFile);
        $outputFile = Yii::getAlias($this->generateFilePath) . DIRECTORY_SEPARATOR . $params['className'] . '.php';

        if (! empty($tip)) {
            $this->output->startPrintf($tip); // record start time
            $this->output->stdout($outputFile . "\n");
            $rst = $this->output->generateFile($params, $template, $outputFile);
            $this->output->endPrintf($tip); // record end time
        } else {
            $this->output->stdout($outputFile);
            $rst = $this->output->generateFile($params, $template, $outputFile);
        }

        return $rst;
    }
public function generateFile(TableSchema $table, $functionName, $tip = null, $indent = 0)
    {
        $params = $this->getParams($table, $functionName, $indent);

        if (
            empty($params['safeUp'])   ||
            empty($params['safeDown']) ||
            empty($params['className'])
        ) {
            return false;
        }

        $template = Yii::getAlias($this->templateFile);
        $outputFile = Yii::getAlias($this->generateFilePath) . DIRECTORY_SEPARATOR . $params['className'] . '.php';

        if (! empty($tip)) {
            $this->output->startPrintf($tip); // record start time
            $this->output->stdout($outputFile . "\n");
            $rst = $this->output->generateFile($params, $template, $outputFile);
            $this->output->endPrintf($tip); // record end time
        } else {
            $this->output->stdout($outputFile);
            $rst = $this->output->generateFile($params, $template, $outputFile);
        }

        return $rst;
    }
Unified generate file interface
@param TableSchema $table
@param string $functionName abstract function name
@see \hzhihua\dump\abstracts\AbstractSchema abstract function name
@param null $tip
@param int $indent text-indent 文本缩进
@return bool