public function __construct($array = null, $values = null)
{
if (!$this->isInstanceOf($array, '\\ArrayAccess') && !$this->isArray($array) && !$this->isArrayObject($array)) {
if ($this->isEmpty($array) || $this->isBool($array)) {
$this->value = array();
} else {
throw new ArrayObjectException(ArrayObjectException::MSG_INVALID_PARAM, ['$array', 'array, ArrayObject, ArrayAccess']);
}
} else {
if ($this->isInstanceOf($array, $this)) {
$this->val($array->val());
} else {
if ($this->isArray($values)) {
// check if both arrays have the same number of values
if (count($array) != count($values)) {
throw new ArrayObjectException(ArrayObjectException::MSG_INVALID_COMBINE_COUNT);
}
$this->value = array_combine($array, $values);
} else {
$this->value = $array;
}
}
}
}