Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TMinLengthValidator.php

Documentation is available at TMinLengthValidator.php

  1. <?php
  2. namespace Adianti\Validator;
  3.  
  4. use Adianti\Validator\TFieldValidator;
  5. use Adianti\Core\AdiantiCoreTranslator;
  6. use Exception;
  7.  
  8. /**
  9.  * Minimum length validation
  10.  *
  11.  * @version    7.4
  12.  * @package    validator
  13.  * @author     Pablo Dall'Oglio
  14.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  15.  * @license    http://www.adianti.com.br/framework-license
  16.  */
  17. {
  18.     /**
  19.      * Validate a given value
  20.      * @param $label Identifies the value to be validated in case of exception
  21.      * @param $value Value to be validated
  22.      * @param $parameters aditional parameters for validation (length)
  23.      */
  24.     public function validate($label$value$parameters NULL)
  25.     {
  26.         $length $parameters[0];
  27.         
  28.         if (strlen(trim($value)) $length)
  29.         {
  30.             throw new Exception(AdiantiCoreTranslator::translate('The field ^1 can not be less than ^2 characters'$label$length));
  31.         }
  32.     }
  33. }