public function setOptions() { if (func_num_args() == 2) { $this->options[func_get_arg(0)] = func_get_arg(1); } else { if (func_num_args() == 1 && is_array(func_get_arg(0))) { foreach (func_get_arg(0) as $key => $option) { $this->options[$key] = $option; } } else { throw new Exception('Invalid number of options provided for the method "setOptions"'); } } return $this; }
/** * @expectedException Exception */ public function testSetOptions() { $this->table->setOptions('foo', 'bar'); $this->table->setOptions(array('foo2' => 'bar2', 'foo3' => 'bar3')); $this->table->setOptions('foo', 'bar', 'baz'); }