API Documentação da API
Conheça  A Ferramenta LowCode mais moderna e veloz para desenvolvimento PHP: Adianti Creator
Pacote Dominando o Adianti Framework
Curso + Livro + Apps exemplo
Curso completo em Video Aulas (114 aulas).
Livro completo em PDF (463 páginas).
Códigos-fontes de Apps de Exemplo.
API
API do Framework
Documentation

Documentation

TCNPJValidator extends TFieldValidator
in package

CNPJ validation (Valid only in Brazil)

Tags
version
8.6
author

Pablo Dall'Oglio

copyright

Copyright (c) 2006 Adianti Solutions Ltd.

license

https://adiantiframework.com.br/license

Table of Contents

Constants

WEIGHTS  : mixed = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
Validation weights

Methods

validate()  : mixed
Validate a given value
calculateDigit()  : int
Calculate a verification digit
charValue()  : int
Convert a character to its numeric value according to the official CNPJ alphanumeric rule
checkDigits()  : bool
Verify check digits
isValidFormat()  : bool
Verify basic format rules

Constants

WEIGHTS

Validation weights

private mixed WEIGHTS = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]

Methods

validate()

Validate a given value

public validate(mixed $label, mixed $value[, mixed $parameters = null ]) : mixed
Parameters
$label : mixed

Identifies the value to be validated in case of exception

$value : mixed

Value to be validated

$parameters : mixed = null

Additional parameters for validation

calculateDigit()

Calculate a verification digit

private calculateDigit(string $value, int $offset) : int
Parameters
$value : string
$offset : int
Return values
int

charValue()

Convert a character to its numeric value according to the official CNPJ alphanumeric rule

private charValue(string $char) : int
Parameters
$char : string
Return values
int

checkDigits()

Verify check digits

private checkDigits(string $cnpj) : bool
Parameters
$cnpj : string
Return values
bool

isValidFormat()

Verify basic format rules

private isValidFormat(string $cnpj) : bool
Parameters
$cnpj : string
Return values
bool
On this page

Search results