You are here

public function Twig_Node_Expression_Array::getKeyValuePairs in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Node/Expression/Array.php \Twig_Node_Expression_Array::getKeyValuePairs()
3 calls to Twig_Node_Expression_Array::getKeyValuePairs()
Twig_Node_Expression_Array::compile in vendor/twig/twig/lib/Twig/Node/Expression/Array.php
Compiles the node to PHP.
Twig_Node_Expression_Array::hasElement in vendor/twig/twig/lib/Twig/Node/Expression/Array.php
Twig_Node_Expression_Array::__construct in vendor/twig/twig/lib/Twig/Node/Expression/Array.php
Constructor.

File

vendor/twig/twig/lib/Twig/Node/Expression/Array.php, line 27

Class

Twig_Node_Expression_Array

Code

public function getKeyValuePairs() {
  $pairs = array();
  foreach (array_chunk($this->nodes, 2) as $pair) {
    $pairs[] = array(
      'key' => $pair[0],
      'value' => $pair[1],
    );
  }
  return $pairs;
}