src/Twig/Data/VariableNameAndArrayKeysPair.php
/**
   * Generates Twig context array keys.
   *
   *  Of the variable the object represents inside the Twig context.
   *
   * @return string
   *   E.g. ['myVariable']['aKey']['anotherKey'].
   *   Which may be used to access the value
   *   of the variable from the Twig context when compiling:
   *   $context['myVariable']['aKey']['anotherKey'].
   */
Generates Twig context array keys.
Of the variable the object represents inside the Twig context.


Generates Twig context array keys . Of the variable the object represents inside the Twig context .
public function toTwigContextArrayKeysString(): string {
    if (!$this->isVariableNameEmpty()) {
      $string = $this->formatAsArrayKeyString($this->getVariableName());
    }
    else {
      throw new Error('Cannot generate valid Twig variable string, variable name is empty.');
    }
    if (!$this->isArrayKeysEmpty()) {
      foreach ($this->getArrayKeys() as $arrayKey) {
        $string .= $this->formatAsArrayKeyString($arrayKey);
      }
    }
    return $string;
  }
public function toTwigContextArrayKeysString ( ) : string { if ( ! $ this -> isVariableNameEmpty ( ) ) { $ string = $ this -> formatAsArrayKeyString ( $ this -> getVariableName ( ) ) ; } else { throw new Error ( 'Cannot generate valid Twig variable string, variable name is empty.' ) ; } if ( ! $ this -> isArrayKeysEmpty ( ) ) { foreach ( $ this -> getArrayKeys ( ) as $ arrayKey ) { $ string .= $ this -> formatAsArrayKeyString ( $ arrayKey ) ; } } return $ string ; }
Generates Twig context array keys.
Generates Twig context array keys .