Validate_ptBR
[ class tree: Validate_ptBR ] [ index: Validate_ptBR ] [ all elements ]

Class: Validate_ptBR

Source Location: /Validate_ptBR-0.5.5/Validate/ptBR.php

Class Overview


Data validation class for Brazil


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 1997-2005 Silvano Girardi Jr.

Methods


Inherited Variables

Inherited Methods


Class Details

[line 46]
Data validation class for Brazil

This class provides methods to validate:

  • Regions - brazilian states (Estados brasileiros)
  • Phone Numbers - brazilian phone numbers
  • Vehicle Plates - brazilian vehicle's plate



[ Top ]


Method Detail

carReg   [line 294]

bool carReg( string $reg)

Validates a brazilian (ptBR) vehicle's plate

Also allows the following formats XXX-XXXX,XXX XXXX,XXXXXXX The first three chars are [A-Z] The last four chars are [0-9]

  • Access: public

Parameters:

string   $reg   —  vehicle's plate

[ Top ]

cnpj   [line 142]

bool cnpj( string $cnpj)

  • Return: true if $cnpj is ok, false otherwise
  • Access: public

Parameters:

string   $cnpj   —  CNPJ to validate

[ Top ]

cpf   [line 71]

bool cpf( string $cpf)

  • Return: true if $cpf is ok, false otherwise
  • Access: public

Parameters:

string   $cpf   —  CPF to validate

[ Top ]

phoneNumber   [line 267]

bool phoneNumber( string $number, [bool $requireAreaCode = true])

Validates a brazilian (ptBR) phone number.

Also allows the formats If $requiredAreaCode is true: (XX)-XXXX-XXXX,(XX) XXXX XXXX, (XX)-XXXX XXXX, (XX) XXXX-XXXX, XX-XXXX-XXXX,XX XXXX XXXX,XX-XXXX XXXX,XX XXXX-XXXX,XX XXXXXXXX,(XX)XXXXXXXX If $requiredAreaCode is false: XXXX-XXXX,XXXX XXXX, XXXXXXXX

  • Return: The valid or invalid phone number
  • Access: public

Parameters:

string   $number   —  phone to validate
bool   $requireAreaCode   —  require the area code? (default: true)

[ Top ]

pis   [line 312]

bool pis( string $pis)

Validate PIS (Programa de Integracao Social)

Allows the following formats XXX.XXX.XXX-XX, XXXXXXXXXXX or any combination with dots and/or hyphens

  • Access: public

Parameters:

string   $pis   —  pis code

[ Top ]

postalCode   [line 59]

bool postalCode( string $postalCode, [bool $strong = false])

  • Return: true if $cep is ok, false otherwise
  • Access: public

Parameters:

string   $postalCode   —  pt_BR CEP/postalCode to validate
bool   $strong   —  optional; strong checks (e.g. against a list of postcodes) (not implanted)

[ Top ]

region   [line 218]

bool region( string $region)

Validates a "region" (i.e. state) code
  • Return: true if $region is ok, false otherwise
  • Access: public

Parameters:

string   $region   —  2-letter state code

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:26:36 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.