[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/security/ -> pipelineresult.class.php (source)

   1  <?php
   2  
   3      
   4  
   5      /**
   6       * \ingroup Security
   7       *
   8       * this object is passed from PipelineFilter objects to the Pipeline, and
   9       * carries information about what the outcome of the processing
  10       * was. If negative (the method PipelineResult::isValid() returns false), then
  11       * the processing will be stopped and no more filters will be executed. Control will
  12       * be returned to the calling class which will decide what to do.
  13       *
  14       * @see Pipeline
  15       */
  16      class PipelineResult  
  17      {
  18          
  19          var $_valid;
  20           var $_errorCode;
  21          var $_errorMessage;
  22          var $_view;        
  23  
  24          /**
  25           * Constructor of this type of object
  26           *
  27           * @param valid By default, all results are positive. If not, please specify otherwise
  28           * @param errorCode Which error code to return. Error codes depend on the filter and might
  29           * or might not be interpreted by the calling class.
  30           * @param errorMessage Error message that should be returned, if any.
  31           */
  32      	function PipelineResult( $valid = true, $errorCode = 0, $errorMessage = "" )
  33          {
  34              $this->_valid = $valid;
  35              $this->_errorCode = $errorCode;
  36              $this->_errorMessage = $errorMessage;
  37              $this->_view = null;
  38          }
  39  
  40          /**
  41           * Returns wether the pipeline failed or succeeded
  42           *
  43           * @return A boolean value, true if successful or false otherwise
  44           */
  45          function isValid()
  46          {
  47              return $this->_valid;
  48          }
  49          
  50          /**
  51           * Sets whether this is a valid result, or if processing will be stopped here
  52           *
  53           * @param valid Whether the processing was successful (valid) or not
  54           */
  55          function setValid( $valid )
  56          {
  57              $this->_valid = $valid;
  58              
  59              return true;
  60          }
  61  
  62          /**
  63           * Extended error code
  64           *
  65           * @return An error code carrying extended information. The value of this
  66           * field is completely depending on the implementation of the filter
  67           */
  68          function getErrorCode()
  69          {
  70              return $this->_errorCode;
  71          }
  72          
  73          /**
  74           * Sets the extended error code.
  75           *
  76           * @param errorCode the new error code
  77           */
  78          function setErrorCode( $errorCode )
  79          {
  80              $this->_errorCode = $errorCode;
  81              
  82              return true;
  83          }
  84  
  85          /**
  86           * An optional error message
  87           *
  88           * @return An string describing the error, if any
  89           */
  90          function getErrorMessage()
  91          {
  92              return $this->_errorMessage;
  93          }
  94          
  95          /**
  96           * Sets the error message.
  97           *
  98           * @param errorMessage A string representing the new error message
  99           */
 100          function setErrorMessage( $errorMessage ) 
 101          {
 102              $this->_errorMessage = $errorMessage;
 103              
 104              return true;
 105          }
 106          
 107          /**
 108           * Whether this result object has a custom view or not
 109           *
 110           * @return True if there is a custom view object that should be shown instead of the
 111           * default one or false otherwise
 112           */
 113  		function hasView()
 114          {
 115              return( $this->_view != null );
 116          }    
 117          
 118          /**
 119           * Returns a custom view that can be used instead of the default
 120           * ErrorView
 121           *
 122           * @param view A valid View, or a class extending from the base View
 123           * @return nothing
 124           */
 125  		function setView( $view )
 126          {
 127              $this->_view = $view;
 128          }
 129          
 130          /**
 131           * returns the custom view, if any
 132           *
 133           * @return A valid View, or a class extending from the base View
 134           */
 135  		function getView()
 136          {
 137              return( $this->_view );
 138          }
 139      }
 140  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics