@param       $name
@param array $context
@param array $blocks
@param bool  $useBlocks

@return mixed
963172
public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true)
    {
        return $this->template->renderBlock($name, $context, $blocks, $useBlocks);
    }
1230336
public function renderBlock(OutputBuffer $out, $name)
	{
		if(array_key_exists($name, $this->blocks))
		{
			$pblock = $this->outerContext->set('@block', $name);
			$pout = $this->outerContext->set('@out', $out);
			$pthis = $this->outerContext->set('@this', $this);
			
			try
			{	
				$this->blocks[$name]($out);
				
				return;
			}
			finally
			{
				$this->outerContext->set('@block', $pblock);
				$this->outerContext->set('@out', $pout);
				$this->outerContext->set('@this', $pthis);
			}
		}
		
		return parent::renderBlock($out, $name);
	}
1344776
protected function renderBlock($name, $parameters)
    {
        /** @var Twig_TemplateInterface $template */
        foreach ($this->getTemplates() as $template) {
            if ($template->hasBlock($name)) {

                $context = array_merge(
                    $template->getEnvironment()->getGlobals(),
                    $parameters
                );

                return $template->renderBlock($name, $context);
            }
        }

        throw new \InvalidArgumentException(sprintf('Block "%s" doesn\'t exist in grid template.', $name));
    }
751717
public function getContext($name)
    {
        /** @var \AppserverIo\Appserver\Core\Api\Node\ContextNode $context */
        foreach ($this->getContexts() as $context) {
            if ($context->getName() === $name) {
                return $context;
            }
        }
    }
265363
public function displayParentBlock($name, array $context, array $blocks = array())
    {
        $name = (string) $name;

        if (isset($this->traits[$name])) {
            $this->traits[$name][0]->displayBlock($name, $context, $blocks);
        } elseif (false !== $parent = $this->getParent($context)) {
            $parent->displayBlock($name, $context, $blocks);
        } else {
            throw new Twig_Error_Runtime(sprintf('The template has no parent and no traits defining the "%s" block', $name), -1, $this->getTemplateName());
        }
    }
482865
protected function process_block_rule($name, $block) {
        $this->rulestack[] = array('callback' => method_exists($this, $name."_block_rule") ? $name."_block_rule" : null, 'rule' => $block);

        $this->string = preg_replace_callback($block['expression'], array($this, 'block_callback'), $this->string);

        array_pop($this->rulestack);
    }
208919
protected static function get_context_block_data(\context_block $context, \stdClass $user) : \stdClass {
        global $DB;

        $block = $DB->get_record('block_instances', ['id' => $context->instanceid]);

        $basedata = (object) [
            'blocktype' => get_string('pluginname', 'block_' . $block->blockname)
        ];

        return $basedata;
    }
759697
public function block($name, $options=[]) {

        if (!isset($this->blocks[$name])) return null;

        $options = \array_merge([
            'print' => true
        ], $options);

        $block = \implode("\n", $this->blocks[$name]);

        if ($options['print']){
            echo $block;
        }

        return $block;
    }
582743
protected function renderBlock($name, $vars)
    {
        if (!$this->template->hasBlock($name)) {
            throw new \RuntimeException('Block "' . $name . '" not found.');
        }
        return $this->template->renderBlock($name, $vars);
    }
457129
public function getMissingLocalesForBlockName($name)
    {
        $locales = array();
        foreach ($this->locales as $locale)
        {
            if (!$this->hasContentBlock($name, $locale))
            {
                $locales[$locale] = $locale;
            }
        }

        return $locales;
    }
1015337
public function hasContentBlock($name, $locale)
    {
        $this->fetchBlocks();

        return isset($this->blocks[$name][$locale]);
    }
886412
private function createDocBlockContext(): Context
    {
        $file = $this->descriptor->getFile();
        $namespaceAliases = $file ? $file->getNamespaceAliases()->getAll() : [];
        foreach ($namespaceAliases as $alias => $fqsen) {
            $namespaceAliases[$alias] = (string) $fqsen;
        }

        return new Context((string) $this->descriptor->getNamespace(), $namespaceAliases);
    }
289825
public function start($name) {

        if (!isset($this->blocks[$name])){
            $this->blocks[$name] = [];
        }

        \ob_start();
    }
78204
private function getBlockByName($name, $resourcesName)
    {
        if (isset($this->blocks[$name])) {
            return [$name => $this->blocks[$name]];
        }

        foreach ($this->{$resourcesName} as &$template) {
            if (!$template instanceof Twig_Template) {
                $template = $this->twig->loadTemplate($template['template']);
            }

            $tpl = $template;

            $block = $this->searchBlock($name, $tpl);
            if ($block !== null) {
                $this->blocks[$name] = $block;

                return [$name => $block];
            }
        }

        return [];
    }
518179
public function render($name, array $context = [])
    {
        $template = $this->environment->loadTemplate($name);
        return $template->render($context);
    }
400194
public function placeholderFunction($name, $default = null)
    {
        if (($result = Block::get($name)) === null) {
            return null;
        }

        $result = str_replace('<!-- X_OCTOBER_DEFAULT_BLOCK_CONTENT -->', trim($default), $result);
        return $result;
    }
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);
    }