Renders a component's default content, preserves the previous component context.
@param $name
@param array $parameters
@return string Returns the component default contents.
420453
public function renderComponent($name, $parameters = [])
    {
        $result = null;
        $previousContext = $this->componentContext;

        if ($componentObj = $this->findComponentByName($name)) {
            $componentObj->id = uniqid($name);
            $componentObj->setProperties(array_merge($componentObj->getProperties(), $parameters));
            $this->componentContext = $componentObj;
            $result = $componentObj->onRender();
        }

        if (!$result) {
            $result = $this->renderPartial($name.'::default', [], false);
        }

        $this->componentContext = $previousContext;
        return $result;
    }
1165915
public function renderComponent($name, array $props, SSViewer_Scope $scope)
    {
        $templates = [];
        foreach (Config::inst()->get(__CLASS__, 'component_paths') as $path) {
            $templates[] = ['type' => $path, $name];
        }

        // hardcoded default locations that need to come after the configurable
        // ones defined above
        $templates[] = ["type" => "Includes", $name];
        $templates[] = $name;

        $result = Injector::inst()->createWithArgs(SSViewer::class, [$templates]);
        $data = new ComponentData($name, $props);
        $result = $result->process($data);
        // todo(Jake): 2018-03-31
        //
        // Perhaps make this class extend "Object" and add an extension point.
        // $this->extend('updateRenderComponent', $result, $name, $props, $scope);
        //
        return $result;
    }
455222
public static function dump(array $parameters)
    {
        $content = '';

        foreach ($parameters as $key => $value) {
            if (is_bool($value)) {
                $value = $value ? 'true' : 'false';
            }
            $content .= "{$key} = {$value}\n";
        }

        return $content;
    }
354900
public function param($name, $default = null)
    {
        return isset($this->parameters[$name]) ? $this->parameters[$name] : $default;
    }
366745
public function get($name, array $parameters = array())
    {
        if ($this->hasGroup($name)) {
            return $this->callGroup($name, $parameters);
        }

        if ($this->has($name)) {
            $callback = $this->widgets[$name];

            return $this->getCallback($callback, $parameters);
        }

        return null;
    }
573913
public static function renderString($string, array $parameters)
    {
        $replacer = static function ($match) use ($parameters) {
            return $parameters[$match[1]] ?? $match[0];
        };

        return preg_replace_callback('/{{\s*(.+?)\s*}}/', $replacer, $string);
    }
383550
public function render(ResponseInterface $response, $name, array $context = [])
    {
        $file = $this->getFilename($name);

        $twig = $this->getTwig();
        $tmpl = $twig->load($file);
        
        $this->invokePluginsOnRender($file, $context);

        $contents = $tmpl->render($context);
        
        $newResponse = $response->withHeader('Content-Type', 'text/html; charset=' . $twig->getCharset());
        $newResponse->getBody()->write($contents);
        
        return $newResponse;
    }
1324024
public function renderIfExists($name = null)
    {
        if (is_null($name)) {
            $params = $this->currentRoute->get();
            $name = $params[0];
        }

        if (! $this->exists($name)) {
            return '';
        }

        return $this->render($name);
    }
277980
private function prepareContext($parameters)
    {
        $new = array();
        foreach ($parameters as $name => $value) {
            if (is_array($value)) {
                $subNew = array();
                foreach ($value as $index => $subValue) {
                    $subNew[] = sprintf(
                        '<comment>%s</comment>: <comment>%s</comment>',
                        $index,
                        var_export($subValue, true)
                    );
                }
                $new[$name] = sprintf('[%s]', implode(', ', $subNew));

                continue;
            }
            if (!is_object($value) || method_exists($value, '__toString')) {
                $new[$name] = sprintf('<comment>%s</comment>', $value);

                continue;
            }

            $new[$name] = $value;
        }

        return $new;
    }
684977
public function parameter(string $name): ?string
    {
        if (isset($this->parameters[$name])) {
            return $this->parameters[$name];
        }

        return null;
    }
633942
public function render(string $name, array $params = []): string
    {
        $path = $this->finder->findTemplate($name);
        $params = array_merge($this->attributes, $params);

        return $this->engine->render($path, $params);
    }
505850
private function getParameterValue(array $parameter, $name, $default = null)
    {
        if (!array_key_exists($name, $parameter)) {
            return $default;
        }

        return $parameter[$name]->getValue();
    }
485738
public function renderTemplate($name, $type, array $parameters, $isInline)
    {
        switch ($type) {
            case 'style':
                $templateName = $this->getStyleTemplateName($name, $isInline);
                break;
            case 'tag':
            default:
                $templateName = $this->getTagTemplateName($name, $isInline);
        }

        if ($templateName === null) {
            $this->logger->error(
                "Could not render template {$type} '{$name}': no template configured"
            );

            return null;
        }

        if (!$this->templateEngine->exists($templateName)) {
            $this->logger->error(
                "Could not render template {$type} '{$name}': template '{$templateName}' does not exist"
            );

            return null;
        }

        return $this->render($templateName, $parameters);
    }
460261
public function generate($parameters = [])
    {

        $content = $this->getContent();
        if (count($parameters)) {
            foreach ($parameters as $param => $value) {
                $content = str_replace("{{ $param }}", $value, $content);
            }
        }

        return $content;
    }
1222775
public function findURI(string $name, array $parameters = [])
    {
        if (array_key_exists($name, $this->route_names)) {
            $foundUri = $this->route_names[$name];
            // insert provided parameters on his slot
            foreach ($parameters as $parameter => $value) {
                $foundUri = preg_replace("/\{(".$parameter.")(\:\w+)?\}/i", $value, $foundUri);
            }
            return $foundUri;
        }

        return null;
    }
1362884
public function render($name, array $parameters = [])
    {
        $storage = $this->load($name);
        $key = hash('sha256', serialize($storage));
        $this->current = $key;
        $this->parents[$key] = null;

        // attach the global variables
        $parameters = array_replace($this->getGlobals(), $parameters);
        // render
        if (false === $content = $this->evaluate($storage, $parameters)) {
            throw new \RuntimeException(sprintf('The template "%s" cannot be rendered.', $this->parser->parse($name)));
        }

        // decorator
        if ($this->parents[$key]) {
            $slots = $this->get('slots');
            $this->stack[] = $slots->get('_content');
            $slots->set('_content', $content);

            $content = $this->render($this->parents[$key], $parameters);

            $slots->set('_content', array_pop($this->stack));
        }

        return $content;
    }
546302
public function make($name, $parameters = []) {
		$name = $this->getAlias($name);

		if (is_string($name) && $this->resolved($name)) {
			return $this->instances[$name];
		}

		if (is_callable($name) || (is_string($name) && !$this->registered($name))) {
			return $this->build($name, $parameters ?: []);
		}

		list($builder, $singleton) = $this->extractComponentBuilder($name);

		$component = $this->build($builder, $parameters);

		if ($this->hasExtender($name)) {
			$extenders = $this->getExtenders($name);
			$component = $this->resolveExtend($component, $extenders);
		}

		if ($singleton) {
			$this->instance($name, $component);
		}

		return $component;
	}