Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Method nameDescriptionExample
   
   
   
   
   
   
   
   
   
   
   
   
   
   

 

How to use

At first you need to get an validator object. To reach this goal you have to call the static getInstance method from the cValidatorFactory class.

With the first parameter parameter you can choose whitch instance the factory will create. For example if you want to get an instance of the cValidatorEmail class just type the

parameter 'email'.

 

Code Block
languagephp
$email = cValidatorFactory::getInstance('email');
$email->isValid('contenido@contenido.org');

The call of the isValid method above returns true.

Code Block
languagephp
$email = cValidatorFactory::getInstance('email');
$email->isValid('contenido@@contenido.org');

The call of the isValid method above returns false. 

Code Block
languagephp
$regex = cValidatorFactory::getInstance('regex');
$regex->setOption('pattern', '/CONTENIDO/');
$regex->isValid('CONTENIDO 4.9');

The call of the isValid method above returns true.

Code Block
languagephp
$regex = cValidatorFactory::getInstance('regex');
$regex->setOption('pattern', '/CONTENIDO/');
$regex->isValid('CONDENITO 4.9');

The call of the isValid method above returns false.

Adding validator classes