| 1 |
177
|
hco |
<?php |
|
| 2 |
↓
|
hco |
/** |
|
| 3 |
↓
|
hco |
* phpillow CouchDB backend |
|
| 4 |
↓
|
hco |
* |
|
| 5 |
↓
|
hco |
* This file is part of phpillow. |
|
| 6 |
↓
|
hco |
* |
|
| 7 |
↓
|
hco |
* phpillow is free software; you can redistribute it and/or modify it under |
|
| 8 |
↓
|
hco |
* the terms of the GNU Lesser General Public License as published by the Free |
|
| 9 |
↓
|
hco |
* Software Foundation; version 3 of the License. |
|
| 10 |
↓
|
hco |
* |
|
| 11 |
↓
|
hco |
* phpillow is distributed in the hope that it will be useful, but WITHOUT ANY |
|
| 12 |
↓
|
hco |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
| 13 |
↓
|
hco |
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
|
| 14 |
↓
|
hco |
* more details. |
|
| 15 |
↓
|
hco |
* |
|
| 16 |
↓
|
hco |
* You should have received a copy of the GNU Lesser General Public License |
|
| 17 |
↓
|
hco |
* along with phpillow; if not, write to the Free Software Foundation, Inc., 51 |
|
| 18 |
↓
|
hco |
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
| 19 |
↓
|
hco |
* |
|
| 20 |
↓
|
hco |
* @package Core |
|
| 21 |
↓
|
hco |
* @version $Revision: 177 $ |
|
| 22 |
↓
|
hco |
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPL |
|
| 23 |
↓
|
hco |
*/ |
|
| 24 |
↓
|
hco |
|
|
| 25 |
↓
|
hco |
/** |
|
| 26 |
↓
|
hco |
* Validate null inputs |
|
| 27 |
↓
|
hco |
* |
|
| 28 |
↓
|
hco |
* Most likely to be used using the phpillowOrValidator |
|
| 29 |
↓
|
hco |
* |
|
| 30 |
↓
|
hco |
* @package Core |
|
| 31 |
↓
|
hco |
* @version $Revision: 177 $ |
|
| 32 |
↓
|
hco |
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPL |
|
| 33 |
↓
|
hco |
*/ |
|
| 34 |
↓
|
hco |
class phpillowNullValidator extends phpillowValidator |
|
| 35 |
↓
|
hco |
{ |
|
| 36 |
↓
|
hco |
/** |
|
| 37 |
↓
|
hco |
* Validate input as integer |
|
| 38 |
↓
|
hco |
* |
|
| 39 |
↓
|
hco |
* @param mixed $input |
|
| 40 |
↓
|
hco |
* @return null |
|
| 41 |
↓
|
hco |
*/ |
|
| 42 |
↓
|
hco |
public function validate( $input ) |
|
| 43 |
↓
|
hco |
{ |
|
| 44 |
↓
|
hco |
if( $input === null ) { |
|
| 45 |
↓
|
hco |
return $input; |
|
| 46 |
↓
|
hco |
} |
|
| 47 |
↓
|
hco |
|
|
| 48 |
↓
|
hco |
throw new phpillowValidationException( |
|
| 49 |
↓
|
hco |
'The value of a phpillowNullValidator was not null.' |
|
| 50 |
↓
|
hco |
); |
|
| 51 |
↓
|
hco |
} |
|
| 52 |
↓
|
hco |
} |
|
| 53 |
↓
|
hco |
|
|