Assigns variables to the template
@chainable
183601
public function assign($vars, $overwrite=true)
	{
		if(!$overwrite)
		{
			$vars = array_merge($this->_vars, $vars);
		}
		$this->_vars = $vars;
		return $this;
	}
1111625
private function _setDefaults()
    {
        if (!isset(self::$_template))
            self::_initializeDefaults();
        foreach (self::$_template as $k=>$v) {
            if ($k[0] != '_')
                $this->$k = $v;
        }
        return $this;
    }
4405
function prepareTemplates(templates){
  var valueGeneratorsDict = {
    select: function(obj){
      var types = {
        random:function(){
          return obj.choice[Math.floor(Math.random() * obj.choice.length)];
        },
        liner: function(){
          var el = obj.choice.shift();
          obj.choice.push(el);
          return el;
        },
        random_unique: function(){
          function shuffle(o) {
            for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
            return o;
          };
          if(!obj.randomized){obj.randomized = shuffle(obj.choice.slice());}
          var el = obj.randomized.shift();
          if(el===undefined){
            log.notEnoughChoice('random_unique','choice');
            process.exit()
          }
          return el;
        }
      }
      if(!types[obj.type]){
        return log.noTemplateType('select', obj.type, Object.keys(types))
      }
      return types[obj.type]
    },
    lipsum: function(obj){
      if(!(obj.max_char_length&&obj.min_char_length)){
        return log.missingSettings('lipsum', '', ['max_char_length','mim_char_length'])
      }
      var lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
      return function(){
        var chars = Math.floor(Math.random()*(obj.max_char_length-obj.min_char_length)+obj.min_char_length)
        var str = lorem.slice(0, chars)
        while(str.length < chars){
          var len = chars - str.length
          str += ' '+lorem.slice(0, len)
        }
        return str
      }
    },
    number: function(obj){
      var types = {
        random:function(){
          return Math.floor(Math.random()*(obj.max_num-obj.min_num)+obj.min_num);
        },
        incremental: function(){
          tempdata += obj.increments
          return tempdata;
        }
      }

      if(!types[obj.type]){
        return log.noTemplateType('number', obj.type, Object.keys(types))
      }
      if(obj.type == 'random' && !(obj.max_num&&obj.min_num)){
        return log.missingSettings('number', 'random', ['max_num','min_num'])
      }
      if(obj.type == 'incremental'){
        if(!(obj.starting_num&&obj.increments)){
          return log.missingSettings('number', 'incremental', ['starting_num','increments'])
        }
        var tempdata = this[obj.id] = obj.starting_num - obj.increments
      }

      return types[obj.type]
    },
    datetime: function(obj){
      var types = {
        random:function(){
          return output[obj.output_format](new Date(Math.floor(Math.random()*(max-min)+min)));
        },
        incremental: function(){
          tempdata += obj.increments
          return output[obj.output_format](new Date(tempdata));
        }
      }
      var output = {
        toString: function(d){ return d.toString(); },
        toDateString: function(d){ return d.toDateString(); },
        toISOString: function(d){ return d.toISOString(); },
        toJSON: function(d){ return d.toJSON(); },
        toGMTString: function(d){ return d.toGMTString(); },
        toLocaleDateString: function(d){ return d.toLocaleDateString(); },
        toLocaleString: function(d){ return d.toLocaleString(); },
        toLocaleTimeString: function(d){ return d.toLocaleTimeString(); },
        toTimeString: function(d){ return d.toTimeString(); },
        toUTCString: function(d){ return d.toUTCString(); },
        toYMDString:function(d){
          return d.toJSON().split('T')[0]
        }
      }

      if(!types[obj.type]){
        return log.noTemplateType('date', obj.type, Object.keys(types))
      }
      if(obj.type == 'random'){
        if(!(obj.max_datetime&&obj.min_datetime&&obj.output_format)){
          return log.missingSettings('date', 'random', ['max_datetime','min_datetime','output_format'])
        }
        var min = Date.parse(obj.min_datetime)
        var max = Date.parse(obj.max_datetime)
        if(isNaN(min)){
          return log.notParseableDatetime('min_datetime', obj.min_datetime)
        }else if(isNaN(max)){
          return log.notParseableDatetime('max_datetime', obj.max_datetime)
        }
      }
      if(obj.type == 'incremental'){
        if(!(obj.starting_datetime&&obj.increments&&obj.output_format)){
          return log.missingSettings('number', 'incremental', ['starting_datetime','increments','output_format'])
        }
        var tempdata = this[obj.id] = Date.parse(obj.starting_datetime) - obj.increments
        if(isNaN(tempdata)){
          return log.notParseableDatetime('starting_datetime', obj.starting_datetime)
        }
      }

      return types[obj.type]
    }
  }

  /*
  Recursively iterate each key in template object to find `stub_type` key.
  If the object has `stub_type` key, replace itself with corresponding
  function in valueGenerators valid
  Arg:
    - obj (Object)
  */
  function parseTemplate(obj) {
    for (var key in obj) {
      if (obj[key] !== null && typeof(obj[key])=="object") {
        if(obj[key].stub_type){
          if(!valueGeneratorsDict[obj[key].stub_type]){
            log.stubTypeNotFound(obj[key].stub_type)
          }else{
            obj[key].id = crypto.randomBytes(16).toString('hex');
            obj[key] = valueGeneratorsDict[obj[key].stub_type](obj[key])
          }
        }else{
          parseTemplate(obj[key]);
        }
      }
    }
  }

  if(templates){
    Object.keys(templates).map(function(t){
      parseTemplate(templates[t]);
    })
    return templates;
  }else{
    return [];
  }
}
160910
function assign( $blockName, $varName, &$variable )
    {
        if ( isset( $this->BlockValues[$blockName][$varName] ) )
            $variable = $this->BlockValues[$blockName][$varName];
        else
            return false;
        return true;
    }
1175952
public function setTemplate(Template $template = null)
	{
		if ($this->writeOnce($this->template, $template)) {
			$this->template->addTemplateLayout($this);
		}
	}
848971
public function addPlaceholder($name, $value = null, $recursive = false)
    {
        list($name, , $template) = $this->getParentPlaceholder($name);
        if (!isset($template)) {
            $template = $this;
        }
        if ($template === false) {
            if ($this->throwException) {
                throw new TemplateException("Unknown scope: {$name}");
            }
            return;
        }
        $template->placeholders[$name] =
            isset($template->placeholders[$name]) && is_array($template->placeholders[$name])
                ? $this->_merge($template->placeholders[$name], (array)$value, $recursive)
                : $value;
    }
366847
private static void appendToBuilder(UriComponentsBuilder builder, TemplateVariable variable, @Nullable Object value) {

		if (value == null) {

			if (variable.isRequired()) {
				throw new IllegalArgumentException(
						String.format("Template variable %s is required but no value was given!", variable.getName()));
			}

			return;
		}

		switch (variable.getType()) {
			case COMPOSITE_PARAM:
				appendComposite(builder, variable.getName(), value);
				break;
			case REQUEST_PARAM:
			case REQUEST_PARAM_CONTINUED:
				builder.queryParam(variable.getName(), value);
				break;
			case PATH_VARIABLE:
			case SEGMENT:
				builder.pathSegment(value.toString());
				break;
			case FRAGMENT:
				builder.fragment(value.toString());
				break;
		}
	}
241229
public function setTemplate($template)
	{
		if (!($template instanceof Template))
		{
			$template = new Template($template);
		}

		$this->template = $template;
	}
669629
def _scoped_variables(self, nodes_list, **kwargs):
        

        tmp_vars = []
        for node in nodes_list:

            is_assign_node = isinstance(node, nodes.Assign)
            name = node.target.name if is_assign_node else node.name

            # create a temp variable name
            tmp_var = next(self.temp_var_names)

            # save previous context value
            with self._execution():

                # save the current value of this name
                self.output.write('var %s = %s.%s;' % (tmp_var, self.context_name, name))

                # add new value to context
                self.output.write('%s.%s = ' % (self.context_name, name))

                if is_assign_node:
                    self._process_node(node.node, **kwargs)
                else:
                    self.output.write(node.name)

                self.output.write(';')

            tmp_vars.append((tmp_var, name))

        yield

        # restore context
        for tmp_var, name in tmp_vars:
            with self._execution():
                self.output.write('%s.%s = %s;' % (self.context_name, name, tmp_var))
426788
public function put($url, $callable, $name = null, $templatePath = null)
    {
        $this->multiple([\Parable\Http\Request::METHOD_PUT], $url, $callable, $name, $templatePath);
        return $this;
    }
789168
protected function init() {
        $this->data['crud'] = 'd';
        $this->data['edulevel'] = self::LEVEL_OTHER;
        $this->data['objecttable'] = template::TABLE;;
    }
1184027
function () {
      var atts = this.atts, att, eh = this.eh, pvs = this.parent.vscope;
      if (atts) {
          // this template has no controller
          // let's propagate the new attribute values to the current scope
          var vscope = this.vscope;
          for (var i = 0, sz = this.atts.length; sz > i; i++) {
              att = atts[i];
              json.set(vscope, att.name, att.getValue(eh, pvs, null));
          }
      }
  }
259070
public function prepareTemplateVariables($variables)
    {
        if (!isset($variables)) {
            $variables = new \stdClass();
        }

        // Set name property if the schema does not define it.
        if (!isset($variables->name) && !empty($this->schema_name)) {
            $variables->name = $this->schema_name;
        }

        // Set template property if the schema does not define it.
        if (!isset($variables->template) && ($theme = $this->getTheme())) {
            $variables->template = $theme;
        }
    }
531341
private static function setUndefinedVariables()
    {
        $list = array(
            'REQUEST_METHOD',
            'REMOTE_ADDR',
            'SERVER_NAME',
            'SERVER_PORT',
            'REQUEST_URI',
        );

        foreach ($list as $name) {
            if (!array_key_exists($name, $_SERVER)) {
                $_SERVER[$name] = '';
            }
        }
    }
807567
private function setMetaWhereParams(&$nq)
    {
        foreach($this->templateVars as $name => $value)
        {
            if  (strpos($name, '#') === 0)
                $nq->setParameter($name, $value);
        }
    }
1282486
protected function setTemplateDefaultValues()
    {
        if (!isset($this->job)) {
            throw new \InvalidArgumentException('cannot create a viewModel for Templates without a $job');
        }
        $labelQualifications='';
        $labelBenefits='';
        $labelRequirements='';

        $organization = $this->job->getOrganization();
        if (isset($organization)) {
            $labelRequirements = $organization->getTemplate()->getLabelRequirements();
            $labelQualifications = $organization->getTemplate()->getLabelQualifications();
            $labelBenefits = $organization->getTemplate()->getLabelBenefits();
        }
        $this->container['labelRequirements'] = $labelRequirements;
        $this->container['labelQualifications'] = $labelQualifications;
        $this->container['labelBenefits'] = $labelBenefits;

        return $this;
    }
885620
function process( $tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace )
    {
        switch ( $functionName )
        {
            case $this->BlockName:
            {
                // Check for disabled cache.
                $ini = eZINI::instance();
                if ( $ini->variable( 'TemplateSettings', 'TemplateCache' ) != 'enabled' )
                {
                    $text = eZTemplateCacheFunction::processUncached( $tpl, $functionChildren,
                                                                      $rootNamespace, $currentNamespace );
                    $textElements[] = $text;
                    return;
                }
                else
                {
                    $text = eZTemplateCacheFunction::processCachedPreprocess( $tpl,  $functionChildren,
                                                                              $functionParameters, $functionPlacement,
                                                                              $rootNamespace, $currentNamespace );
                    $textElements[] = $text;
                }
            } break;
        }
    }