/** * {@inheritdoc} */ public function applyInternal($value, Scaffold $scaffold) { $builder = new Builder($this->blueprint); $res = []; foreach ($value as $key => $cfg) { $res[$key] = $builder->build($cfg); } $scaffold->input[$this->input_name] = $res; }
public function testDefaultBuild() { $class = 'Nayjest\\Builder\\Test\\Mock\\PersonStruct'; $blueprint = new Blueprint($class); $builder = new Builder($blueprint); $cfg = ['name' => 'Jack', 'email' => '*****@*****.**', 'gender' => 'm', 'age' => 28, 'unknown_option' => '77']; /** @var PersonStruct $inst */ $inst = $builder->build($cfg); $this->assertInstanceOf($class, $inst); $this->assertEquals($inst->name, $cfg['name']); $this->assertEquals($inst->gender, $cfg['gender']); $this->assertEquals($inst->age, $cfg['age']); $this->assertEquals($inst->getEmail(), $cfg['email']); }
/** * {@inheritdoc} */ public function applyInternal($value, Scaffold $scaffold) { $builder = new Builder($this->blueprint); $scaffold->input[$this->input_name] = $builder->build($value); }