phpDocumentor ZNF
Action
[ class tree: ZNF ] [ index: ZNF ] [ all elements ]

Source for file ActionErrors.php

Documentation is available at ActionErrors.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3. /**
  4.  * PHP version 5
  5.  *
  6.  * This source file is subject to version 2.1 of the GNU Lesser General Public
  7.  * License, that is bundled with this package in the file COPYING, available
  8.  * through the world wide web at the following URI:
  9.  * http://www.gnu.org/copyleft/lesser.html.
  10.  *
  11.  * @package    ZNF
  12.  * @subpackage Action
  13.  * @author     Alessandro Rossini <http://www.alessandrorossini.org>
  14.  * @author     Graziano Liberati <http://www.liberati.org>
  15.  * @copyright  2004-2007 The ZNF Development Team
  16.  * @license    LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
  17.  * @version    SVN $Id: ActionErrors.php 43 2007-06-26 23:36:35Z aronnax $
  18.  * @since      Release 0.5.0
  19.  * @link       http://www.zeronotice.org
  20.  */
  21.  
  22. /**
  23.  * <i>ZNF_Action_ActionErrors</i> class encapsulates the error messages being reported by the <i>ZNF_Action_ActionForm->validate()</i> method.
  24.  *
  25.  * Each individual error is described by a key and a relative message.
  26.  *
  27.  * @access     public
  28.  * @package    ZNF
  29.  * @subpackage Action
  30.  * @author     Alessandro Rossini <http://www.alessandrorossini.org>
  31.  * @author     Graziano Liberati <http://www.liberati.org>
  32.  * @copyright  2004-2007 The ZNF Development Team
  33.  * @license    LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
  34.  * @version    SVN $Id: ActionErrors.php 43 2007-06-26 23:36:35Z aronnax $
  35.  * @since      Release 0.5.0
  36.  * @link       http://www.zeronotice.org
  37.  */
  38. {
  39.  
  40.     /**
  41.      * Array where the set of errors are stored.
  42.      *
  43.      * @access protected
  44.      * @var array $_errors 
  45.      */
  46.     protected $_errors = array();
  47.  
  48.     /**
  49.      * Constructs a new <i>ZNF_Action_ActionErrors</i> object.
  50.      *
  51.      * @access public
  52.      */
  53.     public function __construct()
  54.     {
  55.     }
  56.  
  57.     /**
  58.      * Adds an error message to the set of errors.
  59.      *
  60.      * @access public
  61.      * @param int $key 
  62.      * @param string $value 
  63.      */
  64.     public function addError($key$value)
  65.     {
  66.         if ($key{
  67.             $this->_errors[$key$value;
  68.         }
  69.     }
  70.  
  71.     /**
  72.      * Returns the set of errors.
  73.      *
  74.      * @access public
  75.      * @return array 
  76.      */
  77.     public function getErrors()
  78.     {
  79.         return $this->_errors;
  80.     }
  81.  
  82.     /**
  83.      * Returns number of errors.
  84.      *
  85.      * @access public
  86.      * @return int 
  87.      */
  88.     public function getNumErrors()
  89.     {
  90.         return count($this->_errors);
  91.     }
  92.  
  93.     /**
  94.      * Returns an error by the key.
  95.      *
  96.      * @access public
  97.      * @param int $key 
  98.      * @return string 
  99.      */
  100.     public function findError($key)
  101.     {
  102.         if (array_key_exists($key$this->_errors)) {
  103.             return $this->_errors[$key];
  104.         else {
  105.             return null;
  106.         }
  107.     }
  108.  
  109.     /**
  110.      * Destroys the <i>ZNF_Action_ActionErrors</i> object.
  111.      *
  112.      * @access public
  113.      */
  114.     public function __destruct()
  115.     {
  116.     }
  117.  
  118. }
  119.  
  120. /**
  121.  * <i>ZNF_Action_ActionErrorsException</i> is the exception type for the <i>ZNF_Action_ActionErrors</i> class.
  122.  *
  123.  * <i>ZNF_Action_ActionErrorsException</i> extends the <i>Exception</i> class of PHP5.
  124.  *
  125.  * @access     public
  126.  * @package    ZNF
  127.  * @subpackage Action
  128.  * @author     Alessandro Rossini <http://www.alessandrorossini.org>
  129.  * @author     Graziano Liberati <http://www.liberati.org>
  130.  * @copyright  2004-2007 The ZNF Development Team
  131.  * @license    LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
  132.  * @version    SVN $Id: ActionErrors.php 43 2007-06-26 23:36:35Z aronnax $
  133.  * @since      Release 0.5.0
  134.  * @link       http://www.zeronotice.org
  135.  */
  136. class ZNF_Action_ActionErrorsException extends Exception
  137. {
  138. }
  139.  
  140. ?>

Documentation generated on Wed, 14 Nov 2007 23:47:33 +0100 by phpDocumentor 1.4.0