Build file replacing metas in template.

@param array $metas
@param string &$template
@return void
543148
protected function buildStub(array $metas, &$template)
    {
        foreach($metas as $k => $v)
        {
            $template = str_replace("{{". $k ."}}", $v, $template);
        }

        return $template;
    }
1218960
protected function parseTemplate($template, array $vars = array())
    {
        if (strpos($template, '{') === false) {
            return $template;
        }

        if (preg_match_all('@\{\$([A-Za-z0-9_]+)\}@i', $template, $matches)) {
            foreach ($matches[1] as $varName) {
                $template = str_replace('{$' . $varName . '}', $vars[$varName], $template);
            }
        }

        return $template;
    }
775228
protected function addTemplateAssets($template)
    {
        /** @var SplFileInfo $file_info */
        foreach ($template->getAssets() as $filename => $file_info) {
            $this->assets->set($filename, $file_info->getRelativePathname());
        }
    }
117726
public function templates($templates = null) {

        if ($templates !== null && ! is_string($templates)) {
            $this->_userChangedTemplates = array_merge(array_keys($templates), $this->_userChangedTemplates);
        }

        return parent::templates($templates);
    }
1240533
public function add(array $templates)
    {
        $this->setConfig($templates);
        $this->_compileTemplates(array_keys($templates));

        return $this;
    }
570943
public function onParseTemplate(Template $template): void
    {
        if (!$this->environment->isEnabled()) {
            return;
        }

        $this->initialize();
        if ($this->isAutoMappingDisabled($template->getName())) {
            return;
        }

        $templateName = $this->getMappedTemplateName($template->getName());
        if ($templateName) {
            $template->setName($templateName);
        }
    }
778223
public function setMetas(array $metas): MetaAwareInterface
    {
        $this->metas = $metas;

        //convert pluginAnnotation meta to correct key:value pair
        foreach ($this->metas as $index => $meta) {
            if ($meta instanceof PluginConfigAnnotation) {
                unset($this->metas[$index]);
                $this->setMeta($meta->getName(), $meta->getConfig());
            }
        }

        return $this;
    }
647050
public function setTemplates(array $templates) {

        if ($templates !== null && is_array($templates)) {
            $this->_userChangedTemplates = array_merge(array_keys($templates), $this->_userChangedTemplates);
        }

        $this->_setTemplatesWrapper($templates);
    }
1341561
public function onParseTemplate(Template $template): void
    {
        if (substr($template->getName(), 0, 4) !== 'nav_') {
            return;
        }

        $template->navClass = (string) $this->navClass;
    }
438034
public function addTemplates($templates)
    {
        foreach ($templates as $name => $template) {
            $this->twig->getLoader()->setTemplate($name, $template);
        }
    }
811371
public static function fromArray(array $templates): Templates
    {
        // No templates. Nothing to do.
        if (empty($templates)) {
            return new static();
        }

        $result = new static();

        foreach ($templates as $index => $template) {
            $result->add(new Template($template), $index);
        }

        return $result;
    }
959796
public function updateModelMetas( $model, $metas, $metaService ) {

		foreach( $metas as $meta ) {

			if( $meta->belongsTo( $model, static::$parentType ) ) {

				$metaService->update( $meta );
			}
		}

		return true;
	}
1091027
def replace_meta(self, name, content=None, meta_key=None):
        '''
        '''
        children = self.meta._children
        if not content:     # small optimazation
            children = tuple(children)
        meta_key = meta_key or 'name'
        for child in children:
            if child.attr(meta_key) == name:
                if content:
                    child.attr('content', content)
                else:
                    self.meta._children.remove(child)
                return
        if content:
            self.add_meta(**{meta_key: name, 'content': content})
279556
public function setTemplate($template)
    {
        $updateTemplateStm = $this->connection->prepare("UPDATE Page SET template = :template WHERE page_id = :page_id");
        $updateTemplateStm->bindParam(":template", $this->template);
        $updateTemplateStm->bindParam(":page_id", $this->page_id);
        $this->template = $template;
        $updateTemplateStm->execute();
    }
1270040
public function onParseTemplate(Template $template): void
    {
        if (strpos($template->getName(), 'fe_') !== 0) {
            return;
        }

        $template->bootstrapEnvironment = $this->environment;
    }
1090058
public function whereAnyMetaId(array $metas)
	{
		$filters = array();
		
		foreach ($metas as $meta => $data) {
			$value = is_array($data) ? Arr::get($data, 0) : $data;
			$operator = is_array($data) ? Arr::get($data, 1, '=') : '=';
			
			$filters[] = array('id' => $meta, 'value' => $value, 'operator' => $operator);
		}
		
		$this->filters[]['metas'] = $filters;
		
		return $this;
	}
586706
private function publish($template)
    {
        if (! file_exists(app_path('Http' . DIRECTORY_SEPARATOR . 'Requests'))) {
            mkdir(app_path('Http' . DIRECTORY_SEPARATOR . 'Requests'), 0777, true);
        }
        file_put_contents(app_path('Http' . DIRECTORY_SEPARATOR . 'Requests' . DIRECTORY_SEPARATOR . 'Create' . $this->fileName),
            $template[0]);
        file_put_contents(app_path('Http' . DIRECTORY_SEPARATOR . 'Requests' . DIRECTORY_SEPARATOR . 'Update' . $this->fileName),
            $template[1]);
    }