src/Twig/Utility/ExpressionHandler.php
/**
   * Generates an array with the array keys.
   *
   * Pointing to the value location of given expression in the context.
   *
   * @param \Twig\Node\Node $expression
   *   The expression to get the context array keys for.
   *
   * @return string[]
   *   Array with array keys.
   */
Generates an array with the array keys.
Pointing to the value location of given expression in the context.

@param \Twig\Node\Node $expression
The expression to get the context array keys for.

@return string[]
Array with array keys.
Generates an array with the array keys . Pointing to the value location of given expression in the context . @param \ Twig \ Node \ Node $expression The expression to get the context array keys for . @return string [] Array with array keys .
public function buildGetAttrExpressionArrayKeys(Node $expression): array {
    if ($this->isNestedObject($expression)) {
      $dataVariableName = $expression->getNode('attribute')->getAttribute('value');
      $childExpression = $expression->getNode('node');
      $dataVariableArrayKeys = $this->buildGetAttrExpressionArrayKeys($childExpression);
      $dataExpressionArrayKeys = $dataVariableArrayKeys;
      $dataExpressionArrayKeys[] = $dataVariableName;
      return $dataExpressionArrayKeys;
    }
    else {
      $dataVariableName = $expression->getNode('node')->getAttribute('name');
      $dataVariableArrayKey = $expression->getNode('attribute')->getAttribute('value');
      $dataExpressionArrayKeys = [$dataVariableName, $dataVariableArrayKey];
      return $dataExpressionArrayKeys;
    }
  }
public function buildGetAttrExpressionArrayKeys ( Node $ expression ) : array { if ( $ this -> isNestedObject ( $ expression ) ) { $ dataVariableName = $ expression -> getNode ( 'attribute' ) -> getAttribute ( 'value' ) ; $ childExpression = $ expression -> getNode ( 'node' ) ; $ dataVariableArrayKeys = $ this -> buildGetAttrExpressionArrayKeys ( $ childExpression ) ; $ dataExpressionArrayKeys = $ dataVariableArrayKeys ; $ dataExpressionArrayKeys [ ] = $ dataVariableName ; return $ dataExpressionArrayKeys ; } else { $ dataVariableName = $ expression -> getNode ( 'node' ) -> getAttribute ( 'name' ) ; $ dataVariableArrayKey = $ expression -> getNode ( 'attribute' ) -> getAttribute ( 'value' ) ; $ dataExpressionArrayKeys = [ $ dataVariableName , $ dataVariableArrayKey ] ; return $ dataExpressionArrayKeys ; } }
Generates an array with the array keys.
Generates an array with the array keys .