Visit the given $block placeholders into hash representation.
4532
private function visitPlaceholders(Block $block, VisitorInterface $subVisitor): Generator
    {
        foreach ($block->getPlaceholders() as $placeholder) {
            yield $placeholder->getIdentifier() => $subVisitor->visit($placeholder);
        }
    }
178764
def dump
      varset_hash = @varset.to_h
      varset_hash.keys.sort_by(&:to_s).each do |var|
        var_str = var.is_a?(Symbol) ? var.inspect : var
        Ansi.write($stdout, :cyan, var_str, :reset, " => #{varset_hash[var].inspect}\n")
      end
    end
1107317
def transform_hash(original, options={}, &block)
      options[:safe_descent] ||= {}
      new_hash = {}
      options[:safe_descent][original.object_id] = new_hash
      original.inject(new_hash) { |result, (key,value)|
        if (options[:deep] && Hash === value)
          value = options[:safe_descent].fetch( value.object_id ) {
            transform_hash(value, options, &block)
          }
        end
        block.call(result,key,value)
        result
      }
    end
675583
private function extractPlaceholders(): void
  {
    $unknown = [];

    preg_match_all('(@[A-Za-z0-9\_\.]+(\%type)?@)', $this->routineSourceCode, $matches);
    if (!empty($matches[0]))
    {
      foreach ($matches[0] as $placeholder)
      {
        if (isset($this->replacePairs[strtoupper($placeholder)]))
        {
          $this->replace[$placeholder] = $this->replacePairs[strtoupper($placeholder)];
        }
        else
        {
          $unknown[] = $placeholder;
        }
      }
    }

    $this->logUnknownPlaceholders($unknown);
  }
666034
def extract!( *keys, &select_block )
      rv = subset( *keys, &select_block )
      rv.to_h.keys.each do |key|
        filter_parameters.delete( key )
      end
      rv
    end
608125
private function renderPlaceholderRecursive($navItemPageId, $placeholderVar, $prevId, $layoutBlockInstance = null)
    {
        $string = '';
        $i = 0;
        $equalIndex = 1;
        $placeholders = $this->getPlaceholders($navItemPageId, $placeholderVar, $prevId);
        $blocksCount = count($placeholders);
        $variations = Yii::$app->getModule('cmsadmin')->blockVariations;
        
        // foreach all placeholders but preserve varaibles above to make calculations
        foreach ($placeholders as $key => $placeholder) {
            $i++;
            $prev = $key-1;
            $next = $key+1;
            $cacheKey = ['blockcache', (int) $placeholder['id']];

            $blockResponse = $this->getHasCache($cacheKey);
    
            /** @var $blockObject \luya\cms\base\InternalBaseBlock */
            //$blockObject = Block::objectId($placeholder['block_id'], $placeholder['id'], 'frontend', $this->getNavItem());
            $blockObject = Block::createObject($placeholder['class'], $placeholder['block_id'], $placeholder['id'], 'frontend', $this->getNavItem());
    
            if ($blockObject) {
                if ($blockResponse === false) {
                    $className = get_class($blockObject);
                    // insert var and cfg values from database
                    $blockObject->setVarValues($this->jsonToArray($placeholder['json_config_values']));
                    $blockObject->setCfgValues($this->jsonToArray($placeholder['json_config_cfg_values']));
        
                    // inject variations variables
                    $possibleVariations = isset($variations[$className]) ? $variations[$className] : false;
                    $ensuredVariation = false;

                    if ($possibleVariations && isset($possibleVariations[$placeholder['variation']])) {
                        $ensuredVariation = $possibleVariations[$placeholder['variation']];
                    } elseif ($possibleVariations) {
                        foreach ($possibleVariations as $name => $content) {
                            if ($content['is_default']) {
                                $ensuredVariation = $content;
                            }
                        }
                    }
                    if ($ensuredVariation) {
                        // otherwise foreach the configuration variation and assign.
                        foreach ($ensuredVariation as $type => $typeContent) {
                            if (!empty($typeContent)) {
                                $type = strtolower($type);
                                switch ($type) {
                                    case "vars": $blockObject->setVarValues($typeContent); break;
                                    case "cfgs": $blockObject->setCfgValues($typeContent); break;
                                    case "extras":
                                        foreach ($typeContent as $extraKey => $extraValue) {
                                            $blockObject->addExtraVar($extraKey, $extraValue);
                                        }
                                        break;
                                }
                            }
                        }
                    }
                    // set env options from current object environment
                    foreach ($this->getOptions() as $optKey => $optValue) {
                        $blockObject->setEnvOption($optKey, $optValue);
                    }
        
                    $blockObject->setEnvOption('index', $i);
                    $blockObject->setEnvOption('itemsCount', $blocksCount);
                    $blockObject->setEnvOption('isFirst', ($i == 1));
                    $blockObject->setEnvOption('isLast', ($i == $blocksCount));
                    $prevIsEqual = array_key_exists($prev, $placeholders) && $placeholder['block_id'] == $placeholders[$prev]['block_id'];
                    $blockObject->setEnvOption('isPrevEqual', $prevIsEqual);
                    $blockObject->setEnvOption('isNextEqual', array_key_exists($next, $placeholders) && $placeholder['block_id'] == $placeholders[$next]['block_id']);
        
                    if (!$prevIsEqual) {
                        $equalIndex = 1;
                    } else {
                        $equalIndex++;
                    }
                    $blockObject->setEnvOption('equalIndex', $equalIndex);
        
                    // render sub placeholders and set into object
                    $insertedHolders = [];
                    foreach ($blockObject->getConfigPlaceholdersExport() as $item) {
                        $insertedHolders[$item['var']] = $this->renderPlaceholderRecursive($navItemPageId, $item['var'], $placeholder['id'], $blockObject);
                    }
                    $blockObject->setPlaceholderValues($insertedHolders);
                    // output buffer the rendered frontend method of the block
                    if ($layoutBlockInstance) {
                        $blockResponse = $layoutBlockInstance->placeholderRenderIteration($blockObject);
                    } else {
                        $blockResponse = $blockObject->renderFrontend();
                    }
                    
        
                    if ($blockObject->getIsCacheEnabled()) {
                        $this->setHasCache($cacheKey, $blockResponse, null, $blockObject->getCacheExpirationTime());
                        $blockObject->onRegister();
                    }
                } else {
                    $blockObject->onRegisterFromCache();
                }
            }
    
            $string.= $blockResponse;
            
            unset($blockResponse);
        }

        unset($variations);
        unset($placeholders);
        
        return $string;
    }
644531
private Map<String, Object> bindBlocks(PrepareSignatureContext sig, PrepareInvocationContext inv) {

    if(inv == null) {
      return Collections.emptyMap();
    }
    
    BlockDeclContext allDecl = null;
    BlockDeclContext unnamedDecl = null;
    
    List<NamedOutputBlockContext> namedBlocks = new ArrayList<>(inv.namedBlocks);
    Map<String, Object> blocks = new HashMap<>();
    
    for (BlockDeclContext blockDecl : sig.blockDecls) {
      
      if (blockDecl.flag != null) {
        if (blockDecl.flag.getText().equals("*")) {
          if (allDecl != null) {
            throw new ExecutionException("only a single parameter can be marked with '*'", getLocation(blockDecl));
          }
          allDecl = blockDecl;
        }
        else if (blockDecl.flag.getText().equals("+")) {
          if (unnamedDecl != null) {
            throw new ExecutionException("only a single parameter can be marked with '+'", getLocation(blockDecl));
          }
          unnamedDecl = blockDecl;
        }
        else {
          throw new ExecutionException("unknown block declaration flag", getLocation(blockDecl));
        }
        continue;
      }
      
      //Find the block
      
      ParserRuleContext paramBlock = findAndRemoveBlock(namedBlocks, name(blockDecl));
      
      //Bind the block
      
      BoundParamOutputBlock boundBlock = bindBlock(paramBlock);

      blocks.put(name(blockDecl), boundBlock);
      
    }
    
    //
    // Bind unnamed block (if requested)
    //
    
    if (unnamedDecl != null) {
      
      UnnamedOutputBlockContext unnamedBlock = inv.unnamedBlock;
      
      BoundParamOutputBlock boundUnnamedBlock = bindBlock(unnamedBlock);
      
      blocks.put(unnamedDecl.id.getText(), boundUnnamedBlock);
      
    }
    
    //
    // Bind rest of blocks (if requested)
    //
    
    if (allDecl != null) {
      
      Map<String, Block> otherBlocks = new HashMap<>();
      
      // Add unnamed block if it wasn't bound explicitly
      if (inv.unnamedBlock != null && unnamedDecl == null) {
        
        UnnamedOutputBlockContext unnamedBlock = inv.unnamedBlock;
        
        BoundParamOutputBlock boundUnnamedBlock = new BoundParamOutputBlock(unnamedBlock, mode(unnamedBlock), currentScope);
        
        otherBlocks.put("", boundUnnamedBlock);
      }
      
      // Add all other unbound blocks
      for (NamedOutputBlockContext namedBlock : namedBlocks) {
        
        String blockName = nullToEmpty(name(namedBlock));
        
        BoundParamOutputBlock boundNamedBlock = new BoundParamOutputBlock(namedBlock, mode(namedBlock), currentScope);
        
        otherBlocks.put(blockName, boundNamedBlock);
        
      }

      blocks.put(allDecl.id.getText(), otherBlocks);
      
    }

    return blocks;
  }
332330
def hash_dig(hash, *keys)
      keys.inject(hash) { |res, key| res[key] or return nil }
    end
895650
private function filterUntranslatedBlocks(iterable $blocks, ?array $locales, bool $useMainLocale): Generator
    {
        foreach ($blocks as $block) {
            try {
                yield $this->mapper->mapBlock($block, $locales, $useMainLocale);
            } catch (NotFoundException $e) {
                // Block does not have the translation, skip it
            }
        }
    }
280481
def _expand_block(cls, block):
        
        cls._parse_header(BlockHeader, block)
        if 'batches' in block:
            block['batches'] = [cls._expand_batch(b) for b in block['batches']]
        return block
336738
def process_hash(value)
      result = {}
      unless value.empty?
        value.split(",").each do |s|
          k,v = s.split(':').compact.map { |i| i.to_s.strip }
          result[k] = v.to_s
        end
      end
      result
    end
429093
function group( $blockName )
    {
        if ( !isset( $this->BlockValues[$blockName] ) )
        {
            eZDebug::writeError( "Unknown group: '$blockName'", __METHOD__ );
            $ret = null;
            return $ret;
        }
        if ( isset( self::$injectedSettings[$this->FileName][$blockName] ) )
        {
            $ret = array_merge(
                $this->BlockValues[$blockName],
                self::$injectedSettings[$this->FileName][$blockName]
            );
        }
        else
        {
            $ret = $this->BlockValues[$blockName];
        }

        return $ret;
    }
1170958
def to_hash
      characteristics.inject({}) do |memo, (k, v)|
        memo[k] = v.value
        memo
      end
    end
836581
function hashElement(wholeMatch,m1) {

        var blockText = m1;

        blockText = blockText.replace(/\n\n/g,"\n");
        blockText = blockText.replace(/^\n/,"");
        blockText = blockText.replace(/\n+$/g,"");
        blockText = "\n\n~K" + (htmlBlock.push(blockText)-1) + "K\n\n";

        return blockText;
    }
761439
def hashes(self):
        """"""
        for url_variant in self.url_permutations(self.canonical):
            url_hash = self.digest(url_variant)
            yield url_hash
750342
private function visitBlocks(Placeholder $placeholder, VisitorInterface $subVisitor): Generator
    {
        foreach ($placeholder as $block) {
            yield $subVisitor->visit($block);
        }
    }
559302
function hashSet(hash, key, value) {
        hash[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
      }