Rule
[ class tree: Rule ] [ index: Rule ] [ all elements ]

Source for file Mandatory.php

Documentation is available at Mandatory.php

  1. <?php
  2. /**
  3.  * Formagic
  4.  *
  5.  * LICENCE
  6.  *
  7.  * This source file is subject to the new BSD license that is bundled
  8.  * with this package in the file LICENSE.txt.
  9.  * It is also available through the world-wide-web at
  10.  * http://formagic.weasle.de/licence.txt
  11.  * If you did not receive a copy of the license and are unable to
  12.  * obtain it through the world-wide-web, please send an email
  13.  * to licence@weasle.de so we can send you a copy immediately.
  14.  *
  15.  * @category    Formagic
  16.  * @package     Rule
  17.  * @author      Florian Sonnenburg
  18.  * @copyright   Copyright (c) 2007 Florian Sonnenburg
  19.  * @license     http://formagic.weasle.de/licence.txt     New BSD License
  20.  * @version     $Id: Mandatory.php 14 2007-08-13 20:33:26Z meweasle $
  21.  */
  22.  
  23. require_once('Rule.php');
  24.  
  25. /**
  26.  * Checks if value is given
  27.  *
  28.  * @category    Formagic
  29.  * @package     Rule
  30.  * @author      Florian Sonnenburg
  31.  * @copyright   Copyright (c) 2007 Florian Sonnenburg
  32.  * @license     http://formagic.weasle.de/licence.txt     New BSD License
  33.  * @version     $Id: Mandatory.php 14 2007-08-13 20:33:26Z meweasle $
  34.  ***/
  35. {
  36.  
  37.     /**
  38.      * Default error message
  39.      * @var     string 
  40.      ***/
  41.     protected $_errorMessage = 'Bitte Wert eingeben';
  42.  
  43.     /**
  44.      * Default error code
  45.      * @var     integer 
  46.      ***/
  47.     protected $_errorCode = 1;
  48.  
  49.     /**
  50.      * Performs rule check
  51.      *
  52.      * Mandatory rule checks if value is given. Throws formagicRuleException if not.
  53.      *
  54.      * @param mixed $value Value to be checked
  55.      * @return boolean 
  56.      ***/
  57.     public function check($itemObj{
  58.         $value $itemObj->getValue();
  59.         if (empty($value)) {
  60.             return false;
  61.         }
  62.         return true;
  63.     }
  64.  
  65. }

Documentation generated on Thu, 23 Aug 2007 00:29:43 +0200 by phpDocumentor 1.4.0