<?php
/***************************************************************
* ARASPHP WEB DEVELOPING FRAMEWORK
*
* Website: www.arasphp.org
* Author: Arturo López Pérez
* hide@address.com
* Version: 0.02
***************************************************************
*
* This file it's part of ArasPhp Web developing framework.
*
* This project is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This project is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Error Logger
* Serves a error logging tool for the developer
*
* (!) It has nothing to do with the errors the controller may serve to a view.
* This one is used for internal developing errors, not for navigating.
*/
abstract class ErrorLogger {
public $errorLog = NULL;
/**
* Adds an error to the log
* @param string
*/
public function logError($string)
{
$this->errorLog[] = $string;
}
/**
* @return array of errors or null
*/
public function getErrorLog()
{
return $this->errorLog;
}
/**
* Displays all errors on the screen
*/
public function displayErrorLog()
{
if($this->errorLog == NULL)
{
echo("<b>NO ERRORS IN THE LOG</b><br>");
return;
}
echo("<b>ERROR LOG</b><br><ul>");
foreach($this->errorLog as $error)
{
echo "<li>$error</li>";
}
echo "</ul>";
}
/**
* ¿Has errors?
* @return bool
*/
public function failed()
{
if($this->errorLog != NULL)
{
return TRUE;
} else {
return FALSE;
}
}
/**
* ¿Is everything ok?
* @return bool
*/
public function isOk()
{
if($this->errorLog == NULL)
{
return TRUE;
} else {
return FALSE;
}
}
/**
* Cleans up the error log
*/
public function cleanErrorLog()
{
$this->errorLog = NULL;
}
}
?>