| Line | |
|---|
| 1 | <?php
|
|---|
| 2 | /**
|
|---|
| 3 | * validation¥¯¥é¥¹
|
|---|
| 4 | */ |
|---|
| 5 | class SC_Validator { |
|---|
| 6 | var $_error; |
|---|
| 7 | var $_errorMessage; |
|---|
| 8 |
|
|---|
| 9 | /**
|
|---|
| 10 | *
|
|---|
| 11 | *
|
|---|
| 12 | * @param string $method ¼Â»Ü¤¹¤ëvalidation̾
|
|---|
| 13 | * @param mixed $args validation¤ËɬÍפʰú¿ô
|
|---|
| 14 | *
|
|---|
| 15 | * @return object SC_Validator_$method
|
|---|
| 16 | * @example $objValidator = SC_Validator::factory('MAX', 20);
|
|---|
| 17 | */ |
|---|
| 18 | function factory($method, $args = null){ |
|---|
| 19 | $class = 'SC_Validator_' . $method; |
|---|
| 20 | require_once('SC_Validator/' . $method . '.php'); |
|---|
| 21 |
|
|---|
| 22 | return new $class($args); |
|---|
| 23 | } |
|---|
| 24 |
|
|---|
| 25 | /**
|
|---|
| 26 | *
|
|---|
| 27 | *
|
|---|
| 28 | * @param object SC_Param
|
|---|
| 29 | *
|
|---|
| 30 | * @return void
|
|---|
| 31 | */ |
|---|
| 32 | function validate($objParam){} |
|---|
| 33 | |
|---|
| 34 | function is_error(){ |
|---|
| 35 | return $this->_error; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | function is_ok(){ |
|---|
| 39 | $bool = true; |
|---|
| 40 | if ($this->is_error()) { $bool = false; } |
|---|
| 41 | |
|---|
| 42 | return $bool; |
|---|
| 43 | } |
|---|
| 44 |
|
|---|
| 45 | |
|---|
| 46 | function getErrorMessage(){} |
|---|
| 47 | } |
|---|
| 48 | ?> |
|---|
Note: See
TracBrowser
for help on using the repository browser.