Generate content with template data is given.

@param  array  $templateData
@return string
342908
protected function generateContent($templatePath, $templateData)
    {
        $template = $this->getTemplate($templatePath);

        $content = $this->compile($template, $templateData);

        return $content;
    }
1039359
public function getTemplateData($data = [])
    {
        // generate fields
        $fillableColumns = $this->schemaParser->getFillableFields($data['TABLE_NAME']);
        logger($fillableColumns);

        $faker = Factory::create();

        $fieldStr = [];
        foreach ($fillableColumns as $column) {
            try {
                if ($column['field'] === 'password') {
                    $func = 'bcrypt(str_random(10))';
                } else {
                    $faker->getFormatter($column['field']);

                    $func = '$faker->'.$column['field'];
                }
            } catch (\Exception $e) {
                logger($column['type']);
                switch ($column['type']) {
                    case 'tinyInteger':
                        $func = '$faker->randomNumber(2)';
                        break;
                    case 'smallInteger':
                        $func = '$faker->randomNumber(2)';
                        break;
                    case 'mediumInteger':
                        $func = '$faker->randomNumber(4)';
                        break;
                    case 'integer':
                        $func = '$faker->randomNumber(8)';
                        break;
                    case 'char':
                    case 'string':
                        logger($column['field']);
                        if (isset($column['args']) && !empty($column['args'])) {
                            $max = $column['args'];
                        } else {
                            $max = 100;
                        }
                        $func = "str_random($max)";
                        break;
                    case 'text':
                    case 'boolean':
                        $func = '$faker->'.$column['type'].'()';
                        break;
                    case 'date':
                        $func = '$faker->'.'dateTimeBetween()';
                        break;
                    default:
                        $func = '';
                }
            }

            if (!empty($func)) {
                $fieldStr[] = "'".$column['field']."' => ".$func;
            }
            
        }
        $data['FIELDS'] = implode(",\n\t\t", $fieldStr);

        return $data;
    }
143314
private function fillTemplate($templateData)
    {
        $apiVersion = Config::get('generator.api_version');
        $apiPrefix = Config::get('generator.api_prefix');
        $apiNamespace = Config::get('generator.namespace_api_controller');

        $templateData = str_replace('$API_VERSION$', $apiVersion, $templateData);
        $templateData = str_replace('$NAMESPACE_API_CONTROLLER$', $apiNamespace, $templateData);
        $templateData = str_replace('$API_PREFIX$', $apiPrefix, $templateData);

        return $templateData;
    }
1136134
public function view($template, $data = [], $mergeData = [])
    {
        $template = get_instance()->templateEngine->render($template, $data, $mergeData);
        return $template;
    }
982833
protected static function textInsertion($template, array $data)
    {
        $replacements = [];
        foreach($data as $key => $value)
        {
            $replacements['{{' . $key . '}}'] = $value;
        }

        return strtr($template, $replacements);
    }
825349
public function render($template, $vdata=array())
	{
	    if (!$this->templateExists($template)) {
	        return 'Template is not exists:' . $this->getTemplateRelativePath($template);
	    }
	    
		// view vars
	    if ($this->getData()->keys()) {
	        extract($this->getData()->all(), EXTR_SKIP);
		}
		if ($vdata instanceof Collection) {
		    extract($vdata->all(), EXTR_SKIP);
		} elseif ($vdata) {
		    extract($vdata, EXTR_SKIP);
		}
		unset($vdata);
		
		// layout
		$_layout = static::getLayoutFromTemplate($template);
		if (is_null($_layout)) {
		    if ($this->getLayout() && $template !== $this->getLayout() && ($this->options['nolayout'] || !in_array($template, $this->options['nolayout']))) {
		        // layout template
		        // 对于 phtml 模板: {include $__content_template__}
		        // 对于 php 模板:   <?php include $this->include($__content_template__); ?\>
		        $__content_template__ = $template;
		        $template = $this->getLayout();
		    }
		} elseif ($_layout) {
		    $__content_template__ = $template;
		    $template = $_layout;
		}
		
		ob_start();
		require $this->getCompiledFile($template);
		
		$content = ob_get_contents();
		ob_end_clean();
		
		return $content;
	}
1120314
protected function getLink($linkData): string
    {
        $link = '';
        if (\is_array($linkData)) {
            $link = $linkData['link'] ?? '';
        } elseif (\is_string($linkData)) {
            $link = $linkData;
        }
        return $link;
    }
1081385
protected function render($template, $data = array())
    {
        $view        = null;
        $data        = array_merge_recursive($this->all(), $data);
        $data['app'] = $this->app;
        $template    = $this->resolve($template);


        if (! $template) {
            return;
        }

        if (! $this->layout) {
            $view = $this->make($template, $data);
        } else {
            $view = $this->layout->nest('content', $template, $data);
        }

        return $view;
    }
970188
public static function trim(array $contentData)
    {
        $data = [];

        foreach ($contentData as $item) {
            $data[] = trim($item);
        }

        return $data;
    }
1309220
public function renderTemplate($key, $additionalData = array())
    {
        if (!isset($this->templates[$key])) {
            return '';
        }
        
        $output = '';
        
        // Render the template files
        foreach ($this->templates[$key] as $priority => $templateFile) {
            $output .= $this->searchRendererAndRenderTemplate($templateFile, $additionalData);
        }
        
        return $output;
    }
465320
private function fillTemplate($templateData)
    {
        $apiVersion = config('webcore.laravel_generator.api_version', 'v1');
        $apiPrefix = config('webcore.laravel_generator.api_prefix', 'api');

        $templateData = str_replace('$API_VERSION$', $apiVersion, $templateData);
        $templateData = str_replace('$API_PREFIX$', $apiPrefix, $templateData);
        $appNamespace = $this->getLaravel()->getNamespace();
        $appNamespace = substr($appNamespace, 0, strlen($appNamespace) - 1);
        $templateData = str_replace('$NAMESPACE_APP$', $appNamespace, $templateData);

        return $templateData;
    }
1316315
public function compile(array $data = []): string {
		
		// this is our most basic version of a compilation.  it
		// simply assumes that whatever information we have in our
		// data (either the argument or the combination of it and
		// the data property) should just get crammed into our
		// content.  we expect that more complicated views will
		// require more work and so they can overwrite this method.
		
		if ($this->compiled) {
			throw new ViewException("Attempt to recompile view.", ViewException::RECOMPILATION);
		}
		
		// for the convenience of our programmers, we'll let more
		// data be added here -- or maybe it'll be the only way
		// someone adds data.
		
		$this->setData($data);
		
		// now, we'll want to merge our header and footer and put
		// content in the middle.  if we've not received specific
		// content, we just assume it'll be found in our data.
		// then, we can apply our template compiler
		
		if (empty($this->content)) {
			$this->setContent('$content');
		}
		
		$this->compilation = View::compileTemplate(
			($this->header . $this->content . $this->footer),
			$this->data);
		
		// so that we lock our view after compilation, we'll set the
		// compiled flag and then return the content to the calling
		// scope.
		
		$this->compiled = true;
		return $this->compilation;
	}
806073
public function formatTemplateData($viewData = [])
    {
        $log = '';
        reset($viewData);
        foreach ($viewData as $viewName => $viewDataObject) {
            // show debbuging information
            $log .= "TemplateData[$viewName] : <br />\n";
            $log .= print_r($viewDataObject, 1);
        }

        return $log;
    }
609361
protected function getTemplate($templateName)
    {
        $template = new Template($this->getModulePath() . '/Template/' . $this->getThemeName() . '/' . $templateName);
        $template->setVars($this->dataCollection->toArray());

        return $template;
    }
1205237
public function createSurveyFromTemplate($templateId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('POST', 'surveys', [], array_merge($data, [ 'from_template_id' => $templateId ]))
		);
	}
1283743
public function setTemplate($templateName, $data = [])
    {
        if (!empty($data)) {
            if (is_array($data)) {
                $this->_data = array_merge($this->_data, $data);
            }
        }

        return $this;
    }
408062
public function render(string $viewFile, array $viewData = []): string
    {
        return strtr(
            $viewFile,
            array_combine(
                array_map(
                    function ($key) {
                        return '{'.$key.'}';
                    },
                    array_keys($viewData)
                ),
                array_values($viewData)
            )
        );
    }