/**
* add( [spec string], [desc string] )
*
* add( [option object] )
*/
public function add()
{
$num = func_num_args();
$args = func_get_args();
$first = $args[0];
if (is_object($first) && $first instanceof Option) {
$this->addObject($first);
} else {
if (is_string($first)) {
$specString = $args[0];
$desc = isset($args[1]) ? $args[1] : null;
$key = isset($args[2]) ? $args[2] : null;
// parse spec string
$spec = new Option($specString);
if ($desc) {
$spec->desc($desc);
}
if ($key) {
$spec->key = $key;
}
$this->add($spec);
return $spec;
} else {
throw new Exception('Unknown Spec Type');
}
}
}