Render template

@param string $migrationName Migration name.

@return string Rendered tempalte.
19604
public function render($migrationName)
    {
        $loader = new FilesystemLoader(__DIR__ . '/views/%name%');

        $view = new PhpEngine(new TemplateNameParser(), $loader);

        $this->templateInitialization->setMigrationName($migrationName);

        return $view->render($this->getTemplatePath(), array(
            'migrationName' => $migrationName,
            'initUp' => $this->templateInitialization->getInitUp(),
            'initDown' => $this->templateInitialization->getInitDown(),
        ));
    }
630564
public function getTemplate($name)
    {
        dump($name);
        $templateName = $this->loader->getTemplate($name);
        try {
            $template = $this->environment->loadTemplate($templateName);
        } catch (\Twig_Error_Loader $e) {
            throw $e;
        }

        return $template;
    }
518179
public function render($name, array $context = [])
    {
        $template = $this->environment->loadTemplate($name);
        return $template->render($context);
    }
515189
public function render( $filename )
	{
		try
		{
			ob_start();

			$this->_include( $filename );

			return ob_get_clean();
		}
		catch( Exception $e )
		{
			ob_end_clean();
			throw $e;
		}
	}
785083
public function getMigrationTemplate( $name )
    {
        $template = '<?php' . PHP_EOL . PHP_EOL;
        
        if ( '' !== $this->migrationNamespace )
        {
            $template .= 'namespace ' . $this->migrationNamespace . ';' . PHP_EOL . PHP_EOL;
        }
        
        $template .= 'use RawPHP\RawMigrator\Migration;' . PHP_EOL;
        $template .= 'use RawPHP\RawDatabase\IDatabase;' . PHP_EOL . PHP_EOL;
        
        $template .= 'class ' . $name . ' extends Migration' . PHP_EOL;
        $template .= '{' . PHP_EOL;
        
        $template .= '    /**' . PHP_EOL;
        $template .= '     * Implement database changes here.' . PHP_EOL;
        $template .= '     * ' . PHP_EOL;
        $template .= '     * @param IDatabase $db database instance' . PHP_EOL;
        $template .= '     */' . PHP_EOL;
        $template .= '    public function migrateUp( IDatabase $db )' . PHP_EOL;
        $template .= '    {' . PHP_EOL;
        $template .= '        ' . PHP_EOL;
        $template .= '    }' . PHP_EOL . PHP_EOL;
        
        $template .= '    /**' . PHP_EOL;
        $template .= '     * Implement reverting changes here.' . PHP_EOL;
        $template .= '     * ' . PHP_EOL;
        $template .= '     * @param IDatabase $db database instance' . PHP_EOL;
        $template .= '     */' . PHP_EOL;
        $template .= '    public function migrateDown( IDatabase $db )' . PHP_EOL;
        $template .= '    {' . PHP_EOL;
        $template .= '        ' . PHP_EOL;
        $template .= '    }' . PHP_EOL . PHP_EOL;
        
        $template .= '    /**' . PHP_EOL;
        $template .= '     * Alternatively to <code>migrateUp()</code>, this method will' . PHP_EOL;
        $template .= '     * use transactions (if available) to process the database changes.' .
                          PHP_EOL;
        $template .= '     * ' . PHP_EOL;
        $template .= '     * @param IDatabase $db database instance' . PHP_EOL;
        $template .= '     */' . PHP_EOL;
        $template .= '    public function safeMigrateUp( IDatabase $db )' . PHP_EOL;
        $template .= '    {' . PHP_EOL;
        $template .= '        ' . PHP_EOL;
        $template .= '    }' . PHP_EOL . PHP_EOL;
        
        $template .= '    /**' . PHP_EOL;
        $template .= '     * Alternatively to <code>migrateDown()</code>, this method will' . 
                          PHP_EOL;
        $template .= '     * use transactions (if available) to revert changes.' . PHP_EOL;
        $template .= '     * ' . PHP_EOL;
        $template .= '     * @param IDatabase $db database instance' . PHP_EOL;
        $template .= '     */' . PHP_EOL;
        $template .= '    public function safeMigrateDown( IDatabase $db )' . PHP_EOL;
        $template .= '    {' . PHP_EOL;
        $template .= '        ' . PHP_EOL;
        $template .= '    }' . PHP_EOL;
        $template .= '}';
        
        return $this->filter( self::ON_GET_MIGRATION_TEMPLATE_FILTER, $template, $name );
    }
245294
public function parse($migrationName)
    {
        // Split the migration name into pieces
        // create_orders_table => ['create', 'orders', 'table']
        $pieces = explode('_', $migrationName);

        // We'll start by fetching the CRUD action type
        $action = $this->normalizeActionName(array_shift($pieces));

        // Next, we can remove any "table" string at
        // the end of the migration name, like:
        // create_orders_table
        if (end($pieces) == 'table') array_pop($pieces);

        // Now, we need to figure out the table name
        $table = $this->getTableName($pieces);

        return compact('action', 'table');
    }
450880
public function render($name, $params = [])
    {
        if (isset($this->fullQualifiedPathNameWithTemplatePath[$name])) {
            $template   = $this->getNewTemplate();
            $path       = $this->fullQualifiedPathNameWithTemplatePath[$name];

            $template->setFilePath($path->getPath() . '.phtml');

            if ($this->defaultParametersProvided) {
                $template->assignMany($this->defaultParameters);
            }

            if (isset($this->fullQualifiedPathNameWithDefaultParameters[$name])) {
                $template->assignMany($this->fullQualifiedPathNameWithDefaultParameters[$name]);
            }

            if (!empty($params)) {
                $template->assignMany($params);
            }

            $content = $template->render();
        } else {
            $content = '';
        }

        return $content;
    }
1258549
function renderTemplate(fragment, templateName) {
    if (templateName === 'none') return fragment._txt;
    var t = generator.template$[templateName];
    if (!t) {
      log('Unknown template %s for %s, using default.', templateName, fragment._href);
      t = generator.template$.default;
    }

    var out;
    try { out = t(fragment); }
    catch(err) {
      var msg = u.format('Error rendering %s\n\ntemplate: %s\n',
                         fragment._href, templateName, err.stack || err);
      log(msg);
      out = opts.production ? '' : '<pre>' + esc(msg) + '</pre>';
    }

    return out;
  }
631885
public function render($templateName = null, $data = [])
    {
        $this->setTemplate($templateName, $data);

        return json_encode($this->_data);
    }
551624
private function migrate($name, $params = [])
    {
        $generator = new TemplateGenerator();
        $generator->setContent(file_get_contents($name));

        return $generator->generate($params);
    }
382017
public function render(string $name, $params = []) : string
    {
        $params = $this->normalizeParams($params);
        return $this->template->make($name, $params)->render();
    }
235688
public function render(string $template, array $data = []): string
	{
		$data = array_merge($this->data, $data);

		return $this->getRenderer()->make($template, $data)->render();
	}
1029440
private function renderBlock(array $blockNames, $cacheKey, array $context)
    {
        $template = $blockName = null;

        $themes = $this->defaultThemes;
        if (isset($this->themes[$cacheKey])) {
            $themes = array_merge($this->themes[$cacheKey], $this->defaultThemes);
        }

        // Search the template for first block available
        foreach ($blockNames as $name) {
            if ($template = $this->getTemplateForBlock($name, $themes)) {
                $blockName = $name;
                break;
            }
        }

        // Throw if no matching blocks are found
        if (empty($template)) {
            throw new \RuntimeException(sprintf(
                "Block%s %s not found in table themes (%s)",
                count($blockNames) > 1 ? 's' : '', implode(', ', $blockNames), implode(', ', $this->defaultThemes)
            ));
        }

        return $template->renderBlock($blockName, $context);
    }
667617
public function render($templateName = null)
    {
        if ($templateName === null) {
            throw new InvalidArgumentException(
                'An template name is required and will be search relative from configured templates path'
            );
        }
        $this->setTemplateName($templateName);

        return parent::render($templateName);
    }
881560
public function render( $echo = false )
    {
        $rendered_html = '';
        
        if( file_exists( $this->get_template_path() ) ) 
        {
            ob_start();
            include( $this->get_template_path() );
            $rendered_html = ob_get_clean();
        } 
        else 
        {
            throw new \RuntimeException( "Error: cannot render HTML, template file not found at " . $this->get_template_path() );
        }
        
        if( !$echo )
        {
            return $rendered_html;
        }
        echo $rendered_html;
    }
96525
public function add($migrationName) {
		$list = $this->getList(false);
		if(isset($list[$migrationName]))
			return;
		$list[$migrationName] = ['added'=>time()+microtime(true)];
		$this->writeMigrations($list);
	}
1100559
public static function renderTemplate($template, $replacements){
		foreach ($replacements as $find => $replace) {
			$template = \str_replace($find, $replace, $template);
		}
		return $template;
	}