public function init(array $array = array())
{
if (sizeof($array) <= 0) {
$array = array_slice($this->superglobals->_SERVER['argv'], 1);
}
$this->resetValues();
$arguments = new \arrayIterator($array);
if (sizeof($arguments) > 0) {
$value = $arguments->current();
if (self::isArgument($value) === false && $this->defaultHandler === null) {
throw new exceptions\runtime\unexpectedValue('Argument \'' . $value . '\' is invalid');
}
$argument = $value;
$this->values[$argument] = array();
$arguments->next();
while ($arguments->valid() === true) {
$value = $arguments->current();
if (self::isArgument($value) === false) {
$this->values[$argument][] = $value;
} else {
$argument = $value;
if (isset($this->values[$argument]) === false) {
$this->values[$argument] = array();
}
}
$arguments->next();
}
}
return $this;
}