Refactored ActionErrors.class.php.
[timetracker.git] / WEB-INF / lib / form / ActionErrors.class.php
index 0206136..3eaf687 100644 (file)
 // +----------------------------------------------------------------------+
 
 class ActionErrors {
-    var $errors = array();
+  var $errors = array();
 
-    function ActionErrors() {
-    }
+  function __construct() {
+  }
 
-    function isEmpty() {
-        return (count($this->errors)>0 ? false : true);
-    }
+  function no() {
+    return (count($this->errors) > 0 ? false : true);
+  }
 
-    function exist() {
-        return (count($this->errors)>0 ? true : false);
-    }
+  function yes() {
+    return (count($this->errors) > 0 ? true : false);
+  }
 
-    function no() {
-        return (count($this->errors)>0 ? false : true);
-    }
+  function add($message, $arg0 = '', $arg1 = '') {
+    $patterns = array ('/\{0\}/','/\{1\}/');
+    $replace = array($arg0, $arg1);
+    $message = preg_replace ($patterns, $replace, $message);
+    $this->errors[]['message'] = $message;
+  }
 
-    function yes() {
-        return (count($this->errors)>0 ? true : false);
-    }
+  function dump() {
+    print_r($this->errors);
+  }
 
-    function add($message, $arg0 = '', $arg1 = '') {
-       $patterns = array ("/\{0\}/","/\{1\}/");
-               $replace = array ($arg0, $arg1);
-               $message = preg_replace ($patterns, $replace, $message);
-        $this->errors[]["message"] = $message;
-    }    
-    
-    function get($key) {
-        return $this->errors["$key"]["message"];
-    }
-    
-    function dump() {
-        print_r($this->errors);
-    }
-    
-    function getErrors() {
-        return $this->errors;
-    }
+  function getErrors() {
+    return $this->errors;
+  }
 }