public function hasRule($validator)
{
if (empty($this->rules)) {
return false;
}
if ($validator instanceof Validatable) {
return isset($this->rules[spl_object_hash($validator)]);
}
if (is_string($validator)) {
foreach ($this->rules as $rule) {
if (get_class($rule) == __NAMESPACE__ . '\\' . $validator) {
return true;
}
}
}
return false;
}