SVN's being dumb so I'm commiting everything so that I can remove some directories and swap some crap around.
git-svn-id: http://svn.cleancode.org/svn/pickles@28 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
parent
1fb64a5141
commit
15bab71735
15 changed files with 90 additions and 687 deletions
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Error {
|
||||
|
||||
private static $errors;
|
||||
private static $warnings;
|
||||
|
||||
public static function instance() {
|
||||
static $object;
|
||||
|
||||
if (!is_object($object)) {
|
||||
$object = new Error();
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
public static function addError($message) {
|
||||
self::$errors[] = $message;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function addWarning($message) {
|
||||
self::$warnings[] = $message;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getError() {
|
||||
return self::$errors;
|
||||
}
|
||||
|
||||
public static function getWarning() {
|
||||
return self::$warnings;
|
||||
}
|
||||
|
||||
public static function isError() {
|
||||
if (is_array(self::getError()) || is_array(self::getWarning())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function display() {
|
||||
if (self::isError()) {
|
||||
if (self::getError()) {
|
||||
foreach (self::getError() as $error) {
|
||||
echo "{$error}<br />";
|
||||
}
|
||||
}
|
||||
|
||||
if (self::getWarning()) {
|
||||
foreach (self::getWarning() as $error) {
|
||||
echo "{$warning}<br />";
|
||||
}
|
||||
}
|
||||
|
||||
self::$errors = self::$warnings = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue