errorhandler.php 438 B

1234567891011121314151617181920212223
  1. <?php
  2. class ErrorHandler {
  3. private $errors = array();
  4. public static $eh;
  5. public function __construct() {
  6. }
  7. public function addError($errorString) {
  8. $this->errors[] = $errorString;
  9. //error_log($errorString);
  10. }
  11. public function getErrors() {
  12. if(sizeof($this->errors) > 0) {
  13. return "<script type=\"text/javascript\">console.log(\"" . implode('\n', $this->errors) . "\");</script>" . PHP_EOL;
  14. }
  15. }
  16. }