Merge branch 'Issue_#37,_New_Namespaces' into 'master'

Added more documentation and implemented the Logger::backtrace into fatal errors

More documentation and backtrace.

See merge request !14
This commit is contained in:
Abel Hoogeveen 2015-04-29 19:00:15 +02:00
commit 5b50adf530
6 changed files with 46 additions and 7 deletions

View File

@ -4,9 +4,9 @@ namespace FuzeWorks;
use \Exception;
/**
* Config Module
* Config Class
*
* This class gives access to the config files. Allows for reading and editting
* This class gives access to the config files. Can read and write .php files with an array in a file
*/
class Config extends Bus{

View File

@ -9,8 +9,11 @@ if (!defined('FUZESYSPATH')) {
define( 'FUZESYSPATH', dirname(__FILE__) . '/' );
}
// NotifierEvent, base event
// Framework
/**
* FuzeWorks Core
*
* Holds all the modules and starts the framework. Allows for starting and managing modules
*/
class Core {
public $mods;

View File

@ -8,8 +8,16 @@ namespace FuzeWorks;
use \Exception;
/**
* @name Events
*/
* Event Class
*
* Controls FuzeWorks Events. Events are classes that get loaded during special moments in the program.
* These Event objects get send to so-called 'listeners', which can modify the event object, and eventually return them to invoker.
* Typically an event process goes like this:
* - Event get's called
* - Event object is created
* - Event object is send to all listeners in order of EventPriority
* - Event is returned
*/
class Events extends Bus{
private $listeners;

View File

@ -3,6 +3,14 @@
namespace FuzeWorks;
use \Exception;
/**
* Layout Class
*
* The Layout class is a wrapper for the Smarty Template engine. Smarty loads .tpl files and variables, and converts them to HTML.
* See the Smarty documentation for more information
* This class typically loads files from Application/Views unless specified otherwise.
*
*/
class Layout extends Bus {
private $Smarty = array();

View File

@ -3,6 +3,12 @@
namespace FuzeWorks;
use \Exception;
/**
* Logger Class
*
* The main tool to handle errors and exceptions. Provides some tools for debugging and tracking where errors take place
* All fatal errors get catched by this class and get displayed if configured to do so.
*/
class Logger extends Bus{
public $infoErrors = array();
@ -40,6 +46,7 @@ class Logger extends Bus{
// Log it!
$this->errorHandler($errno, $errstr, $errfile, $errline);
$this->logInfo($this->backtrace());
}
if ($this->mods->config->error->debug == true || $this->print_to_screen) {
@ -91,6 +98,13 @@ class Logger extends Bus{
}
public function logToScreen() {
// Send a screenLogEvent, allows for new screen log designs
$event = $this->mods->events->fireEvent('screenLogEvent');
if ($event->isCancelled()) {
return false;
}
// Otherwise just load it
echo '<h3>FuzeWorks debug log</h3>';
$layer = 0;
for($i = 0; $i < count($this->Logs); $i++){
@ -131,7 +145,7 @@ class Logger extends Bus{
$result[] = ($i + 1) . ')' . substr($trace[$i], strpos($trace[$i], ' ')); // replace '#someNum' with '$i)', set the right ordering
}
return "\t" . implode("<br/>", $result);
return "<b>BACKTRACE: <br/>\t" . implode("<br/>", $result)."</b>";
}
/* =========================================LOGGING METHODS==============================================================*/

View File

@ -5,6 +5,12 @@
namespace FuzeWorks;
/**
* Models Class
*
* Simple loader class for MVC Models. Typically loads models from Application/Models unless otherwise specified.
* If a model is not found, it will load a DatabaseModel type which will analyze the database and can directly be used.
*/
class Models extends Bus{
private $models_array = array();