Exemplo n.º 1
0
 /**
  * Populate given data with elements of fieldset
  * values are set to elements using setValue()
  * @param array $data
  * @return self
  */
 public function setData(array $input_data)
 {
     $this->data = $input_data;
     foreach ($input_data as $fieldset => $data) {
         if (isset($this->fieldsets[$fieldset])) {
             $resolver = new InputResolver($data);
             $this->fieldsets[$fieldset]->populateData($resolver->resolve());
         }
     }
     return $this;
 }
Exemplo n.º 2
0
 public function testFlatInput()
 {
     $input = array('first_name' => 'Sahan', 'last_name' => 'HH');
     $final = new InputResolver($input);
     $this->assertEquals(array('first_name' => 'Sahan', 'last_name' => 'HH'), $final->resolve());
 }