Source for file Minbytelength.php

Documentation is available at Minbytelength.php

  1. <?php
  2. /**
  3.  * Teeple2 - PHP5 Web Application Framework inspired by Seasar2
  4.  *
  5.  * PHP versions 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @package     teeple
  14.  * @author      Mitsutaka Sato <miztaka@gmail.com>
  15.  * @license     http://www.php.net/license/3_0.txt  PHP License 3.0
  16.  */
  17.  
  18. /**
  19.  * 文字列の最小バイト数をチェックします。
  20.  *
  21.  * @package teeple.validator
  22.  */
  23. {
  24.  
  25.     public $minbytelength;
  26.     public $charset;
  27.     
  28.     /**
  29.      * エラーメッセージの引数に渡すプロパティ名
  30.      * @var array 
  31.      */
  32.     public $args = array('minbytelength');
  33.     
  34.     protected function execute($obj$fieldName{
  35.         
  36.         $value $this->getTargetValue($obj$fieldName);
  37.         if (Teeple_Util::isBlank($value)) {
  38.             return TRUE;
  39.         }
  40.         
  41.         if (Teeple_Util::isBlank($this->minbytelength|| is_numeric($this->minbytelength)) {
  42.             throw new Teeple_Exception("minbytelengthが正しくセットされていません。");
  43.         }
  44.         
  45.         if (Teeple_Util::isBlank($this->charset)) {
  46.             $value mb_convert_encoding($value$this->charset);
  47.         }
  48.         
  49.         return $this->minbytelength <= strlen($value);
  50.     }
  51.     
  52. }
  53. ?>

Documentation generated on Mon, 26 Apr 2010 08:59:53 +0900 by phpDocumentor 1.4.3