Source for file Validator.php

Documentation is available at Validator.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.  * Validatorの基底クラス
  20.  *
  21.  * @package teeple
  22.  */
  23. abstract class Teeple_Validator
  24. {
  25.     
  26.     /**
  27.      * メッセージの引数に設定されるプロパティの名称を配列で持ちます。
  28.      * @var array 
  29.      */
  30.     public $args = array();
  31.     
  32.     /**
  33.      * Validationを実行します。
  34.      * 子クラスで実装されるexecuteメソッドを呼び出します。
  35.      *
  36.      * @param object $obj 
  37.      * @param string $fieldName 
  38.      * @return boolean 
  39.      */
  40.     public function validate($obj$fieldName{
  41.         return $this->execute($obj$fieldName);
  42.     }
  43.     
  44.     /**
  45.      * 実際のValidationロジックです。子クラスで実装します。
  46.      *
  47.      * @param object $obj 
  48.      * @param string $fieldName 
  49.      */
  50.     abstract protected function execute($obj$fieldName);
  51.  
  52.     /**
  53.      * Validation対象の値を取得します。
  54.      *
  55.      * @param object $obj 
  56.      * @param string $fieldName 
  57.      */
  58.     protected function getTargetValue($obj$fieldName{
  59.         return Teeple_Util::getProperty($obj$fieldName);
  60.     }
  61.     
  62. }
  63. ?>

Documentation generated on Mon, 26 Apr 2010 09:00:03 +0900 by phpDocumentor 1.4.3