private function validar($atributo, $valor) { switch ($atributo) { case 'REG': if ($this->REG === '0150') { throw new \InvalidArgumentException("O campo '{$atributo}' tem que ter o valor '0150'"); } break; case 'COD_PART': if (strlen($valor) > 60) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 60 caracteres"); } break; case 'NOME': if (strlen($valor) > 100) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 100 caracteres"); } break; case 'COD_PAIS': if (!T321::isCodigo($valor)) { throw new \InvalidArgumentException("O campo '{$atributo}' está com um valor invalido"); } break; case 'CNPJ': if (strlen($valor) > 14) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 14 caracteres"); } break; case 'CPF': if (strlen($valor) > 11) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 11 caracteres"); } break; case 'IE': if (strlen($valor) > 14) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 11 caracteres"); } break; case 'COD_MUN': if (strlen($valor) > 14) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 11 caracteres"); } break; case 'COD_MUN': if (TCodMunicipio::isCodigoMunicipio($valor)) { throw new \InvalidArgumentException("No campo '{$atributo}' o valor {$valor} está com valor invalido"); } break; case 'SUFRAMA': if (strlen($valor) > 9) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 7 caracteres"); } break; case 'END': if (strlen($valor) > 60) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 60 caracteres"); } break; case 'NUM': if (strlen($valor) > 10) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 10 caracteres"); } break; case 'COMPL': if (strlen($valor) > 60) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 60 caracteres"); } break; case 'BAIRRO': if (strlen($valor) > 60) { throw new \InvalidArgumentException("O campo '{$atributo}' não pode ter mais que 60 caracteres"); } break; } }