Ejemplo n.º 1
0
 public function addBlocks($blocks)
 {
     foreach ($blocks as $name => $block) {
         if (isset($this->blocks[$name])) {
             py_arr_insert($this->blocks[$name], 0, $block);
         } else {
             $this->blocks[$name] = array($block);
         }
     }
 }
Ejemplo n.º 2
0
 public function testArrInsert()
 {
     $empty_arr = array();
     py_arr_insert($empty_arr, 0, 'first');
     $this->assertEquals($empty_arr, array('first'));
     $input_arr = array('second', 'fourth');
     py_arr_insert($input_arr, 0, 'first');
     $this->assertEquals($input_arr, array('first', 'second', 'fourth'));
     py_arr_insert($input_arr, 2, 'third');
     $this->assertEquals($input_arr, array('first', 'second', 'third', 'fourth'));
 }
Ejemplo n.º 3
0
 /**
  * @param Token $token
  */
 public function prependToken($token)
 {
     py_arr_insert($this->tokens, 0, $token);
 }