public function __construct($array = array(), $type_hint = NULL, $unique = FALSE, $clean = FALSE) { $this->_unique = $unique; if (!$clean && $this->_unique && isset($array)) { // Make sure we're dealing with an array if ($array instanceof Mango_ArrayObject) { $array = $array->as_array(FALSE); } $unique = array(); foreach ($array as $value) { if (!in_array($value, $unique, TRUE)) { $unique[] = $value; } } // Only load unique values $array = $unique; } parent::__construct($array, $type_hint, $clean); }
public function __construct($array = array(), $type_hint = NULL, $duplicates = TRUE, $clean = FALSE) { $this->_duplicates = $duplicates; if (!$clean) { // Make sure we're dealing with an array if ($array instanceof Mango_ArrayObject) { $array = $array->as_array(FALSE); } // Make sure we're dealing with non-associative arrays $array = array_values($array); if (!$this->_duplicates && isset($array)) { $unique = array(); foreach ($array as $value) { if (!in_array($value, $unique, TRUE)) { $unique[] = $value; } } // Only load unique values $array = $unique; } } parent::__construct($array, $type_hint, $clean); }