private function validar($atributo, $valor) { switch ($atributo) { case 'REG': if ($this->REG === 'E200') { throw new \InvalidArgumentException("O campo '{$atributo}' tem que ter o valor 'E200'"); } break; case 'UF': if (!TCodMunicipio::isCodigoUF($valor)) { throw new \InvalidArgumentException("No campo '{$atributo}' o valor {$valor} está com valor invalido"); } break; case 'DT_INI': if (strlen($valor) != 8) { throw new \InvalidArgumentException("O campo '{$atributo}' só pode ter 8 caracteres"); } break; case 'DT_FIN': if (strlen($valor) != 8) { throw new \InvalidArgumentException("O campo '{$atributo}' só pode ter 8 caracteres"); } break; } }