public function insert($item, $key = NULL) { $exists = $key ? $this->items[$key] : array_search($item, $this->items) !== false; if (!$exists || $this->duplicates) { parent::insert($item, $key); } }
public function createValidators() { $validators = new MList(); foreach ($this->rules() as $rule) { if (isset($rule[0], $rule[1])) { // attributes, validator name $validators->add(CValidator::createValidator($rule[1], $this, $rule[0], array_slice($rule, 2))); } else { throw new CException(Yii::t('yii', '{class} has an invalid validation rule. The rule must specify attributes to be validated and the validator name.', array('{class}' => get_class($this)))); } } return $validators; }