schmunk42\giiant\generators\crud\Generator::render PHP Method

render() public method

public render ( $template, $params = [] )
    public function render($template, $params = [])
    {
        $code = parent::render($template, $params);
        // create temp file for code formatting
        $tmpDir = Yii::getAlias('@runtime/giiant');
        FileHelper::createDirectory($tmpDir);
        $tmpFile = $tmpDir . '/' . md5($template);
        file_put_contents($tmpFile, $code);
        if ($this->tidyOutput) {
            $command = Yii::getAlias('@vendor/bin/phptidy') . ' replace ' . $tmpFile;
            shell_exec($command);
            $code = file_get_contents($tmpFile);
        }
        if ($this->fixOutput) {
            $command = Yii::getAlias('@vendor/bin/php-cs-fixer') . ' fix ' . $tmpFile;
            shell_exec($command);
            $code = file_get_contents($tmpFile);
        }
        unlink($tmpFile);
        return $code;
    }