From 465c44f958fbd6036faa996345dafbb2a736732f Mon Sep 17 00:00:00 2001 From: Fabian M Date: Tue, 7 Oct 2014 22:54:02 +0200 Subject: [PATCH] New start --- .gitignore | 14 +- README.markdown | 5 - app/Controllers/DefaultController.php | 11 - app/Main.php | 87 ------- bin/FaabBB | 6 - index.php | 4 - lib/Configuration/ConfigurationException.php | 20 -- lib/Configuration/ConfigurationManager.php | 91 ------- lib/Console/ConsoleTask.php | 30 --- lib/Constants.php | 35 --- lib/Core/Application.php | 154 ------------ lib/Data/config.ini | 9 - lib/Data/core.log | 15 -- lib/Dispatcher/DispatchResponse.php | 45 ---- lib/Dispatcher/Dispatcher.php | 33 --- lib/Error/AbstractErrorFactory.php | 63 ----- lib/Error/AbstractErrorHandler.php | 27 -- lib/Error/AbstractExceptionHandler.php | 27 -- lib/Error/ErrorWrapper.php | 94 ------- lib/Language/IO/InputItem.php | 103 -------- lib/Language/IO/InputManager.php | 38 --- lib/Language/IO/ItemNotExistsException.php | 20 -- lib/Language/Net/HTTP/HttpInputManager.php | 32 --- lib/Language/Net/HTTP/HttpRequest.php | 136 ---------- lib/Language/Net/HTTP/Method.php | 28 --- lib/Language/Net/Request.php | 48 ---- lib/Language/Runtime.php | 83 ------- lib/Language/StackFrame.php | 78 ------ lib/Language/StackTrace.php | 70 ------ lib/Logging/ConsoleHandler.php | 42 ---- lib/Logging/FileHandler.php | 65 ----- lib/Logging/Formatter.php | 27 -- lib/Logging/Handler.php | 56 ----- lib/Logging/Level.php | 109 -------- lib/Logging/LogRecord.php | 118 --------- lib/Logging/Logger.php | 246 ------------------- lib/Logging/SimpleFormatter.php | 48 ---- lib/MVC/Controller.php | 43 ---- lib/MVC/RequestHandlerTask.php | 24 -- lib/Task/Task.php | 27 -- 40 files changed, 10 insertions(+), 2201 deletions(-) delete mode 100755 README.markdown delete mode 100644 app/Controllers/DefaultController.php delete mode 100644 app/Main.php delete mode 100755 bin/FaabBB delete mode 100755 index.php delete mode 100644 lib/Configuration/ConfigurationException.php delete mode 100644 lib/Configuration/ConfigurationManager.php delete mode 100644 lib/Console/ConsoleTask.php delete mode 100644 lib/Constants.php delete mode 100644 lib/Core/Application.php delete mode 100644 lib/Data/config.ini delete mode 100644 lib/Data/core.log delete mode 100644 lib/Dispatcher/DispatchResponse.php delete mode 100644 lib/Dispatcher/Dispatcher.php delete mode 100644 lib/Error/AbstractErrorFactory.php delete mode 100644 lib/Error/AbstractErrorHandler.php delete mode 100644 lib/Error/AbstractExceptionHandler.php delete mode 100644 lib/Error/ErrorWrapper.php delete mode 100644 lib/Language/IO/InputItem.php delete mode 100644 lib/Language/IO/InputManager.php delete mode 100644 lib/Language/IO/ItemNotExistsException.php delete mode 100644 lib/Language/Net/HTTP/HttpInputManager.php delete mode 100644 lib/Language/Net/HTTP/HttpRequest.php delete mode 100644 lib/Language/Net/HTTP/Method.php delete mode 100644 lib/Language/Net/Request.php delete mode 100644 lib/Language/Runtime.php delete mode 100644 lib/Language/StackFrame.php delete mode 100644 lib/Language/StackTrace.php delete mode 100644 lib/Logging/ConsoleHandler.php delete mode 100644 lib/Logging/FileHandler.php delete mode 100644 lib/Logging/Formatter.php delete mode 100644 lib/Logging/Handler.php delete mode 100644 lib/Logging/Level.php delete mode 100644 lib/Logging/LogRecord.php delete mode 100644 lib/Logging/Logger.php delete mode 100644 lib/Logging/SimpleFormatter.php delete mode 100644 lib/MVC/Controller.php delete mode 100644 lib/MVC/RequestHandlerTask.php delete mode 100644 lib/Task/Task.php diff --git a/.gitignore b/.gitignore index 8fbefa3..83e4d0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ -.settings/ -.project -.buildpath -data/logs/*.php +/.settings +/.project +/.buildpath +/composer.phar +/vendor +/nbproject +phpunit.xml +.vagrant +Vagrantfile +.idea \ No newline at end of file diff --git a/README.markdown b/README.markdown deleted file mode 100755 index f918fc2..0000000 --- a/README.markdown +++ /dev/null @@ -1,5 +0,0 @@ -FaabBB 3 -============================================================ -FaabBB is an open-source development framework written in PHP. - -FaabBB isn't in development anymore. diff --git a/app/Controllers/DefaultController.php b/app/Controllers/DefaultController.php deleted file mode 100644 index bd6390e..0000000 --- a/app/Controllers/DefaultController.php +++ /dev/null @@ -1,11 +0,0 @@ -configure(); - } - - - /** - * Get or set the {@link Application} of this class. - * - * @since 3.010 - * @param $app The {@link Application} to set. - * @return The {@link Application} of this class. - * - * If no arguments are given, the current value will be - * returned. - */ - public static function app($app = null) { - if ($app == null) - return self::$app; - self::$app = $app; - return self::$app; - } - -} - -// Initialize the main class. -Main::init(); - -?> diff --git a/bin/FaabBB b/bin/FaabBB deleted file mode 100755 index 1abeedc..0000000 --- a/bin/FaabBB +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/php -launch('cli', array('ARGUMENTS' => $_SERVER['argv'])); -?> diff --git a/index.php b/index.php deleted file mode 100755 index 4e6c10c..0000000 --- a/index.php +++ /dev/null @@ -1,4 +0,0 @@ -launch(); -?> diff --git a/lib/Configuration/ConfigurationException.php b/lib/Configuration/ConfigurationException.php deleted file mode 100644 index 0ecbdd5..0000000 --- a/lib/Configuration/ConfigurationException.php +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/lib/Configuration/ConfigurationManager.php b/lib/Configuration/ConfigurationManager.php deleted file mode 100644 index b5d671b..0000000 --- a/lib/Configuration/ConfigurationManager.php +++ /dev/null @@ -1,91 +0,0 @@ -properties = $parsed; - } - - /** @Override */ - public function __get($name) { - return isset($this->properties[$name]) ? $this->properties[$name] - : null; - } - - /** @Override */ - public function __set($name, $value) { - $this->properties[$name] = $value; - } - - /** @Override */ - public function __isset($name) { - return isset($this->properties[$name]); - } - - /** @Override */ - public function __unset($name) { - unset($this->properties[$name]); - } - - /** @Override */ - public function offsetSet($name, $value) { - $this->__set($name, $value); - } - - /** @Override */ - public function offsetExists($name) { - return $this->__isset($name); - } - - /** @Override */ - public function offsetUnset($name) { - $this->__unset($name); - } - - /** @Override */ - public function offsetGet($name) { - return $this->__get($name); - } -} -?> diff --git a/lib/Console/ConsoleTask.php b/lib/Console/ConsoleTask.php deleted file mode 100644 index e2e866a..0000000 --- a/lib/Console/ConsoleTask.php +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/lib/Core/Application.php b/lib/Core/Application.php deleted file mode 100644 index 6ab514d..0000000 --- a/lib/Core/Application.php +++ /dev/null @@ -1,154 +0,0 @@ -runtime; - } - - /** - * Returns the {@link ConfigurationManager} of this class. - * - * @since 3.010 - * @return The {@link ConfigurationManager} of this class. - */ - public function getConfiguration() { - return $this->config; - } - - - /** - * Constructs a new {@link Application} instance. - */ - public function __construct($logging = true) { - $this->runtime = new Runtime(); - $this->logger = new Logger("core"); - if ($logging) - $this->logger->addHandler(new FileHandler(CORE_LOG_FILE)); - $this->logger->info(Constants::$PRODUCT . ' version ' . - Constants::$VERSION . "\n" . Constants::$DESCRIPTION); - } - - /** - * Starts the {@link Task} by the given name. - * - * @since 3.010 - * @param $name The name of the {@link Task} to start. - * @param $args The arguments to give to this {@link Task}. - */ - public function launch($name = "default", $args = array()) { - !isset($this->tasks[$name]) or - $this->tasks[$name]->start($this, $this->runtime->getRequest(), - null, $args); - } - /** - * Bind the given {@link Task} to the given - * name. - * Manager - * @since 3.010 - * @param $name The name of this task. - * @param $task The {@link Task} to set. - */ - public function bind($name, $value) { - if (is_string($name)) { - $this->tasks[$name] = $value; - } else if (is_array($name) && is_array($value)) { - for ($i = 0; $i < count($name); $i++) { - $this->tasks[$name[i]] = $value[i]; - } - } - } - - /** - * Configure this {@link Application} instance using the given - * {@link ConfigurationManager}. - * - * @since 3.010 - * @param $configurationManager The {@link ConfigurationManager} to configure - * this application with. - */ - public function configure($configurationManager = null) { - if ($configurationManager == null || - $configurationManager instanceof ConfigurationManager) { - - $configurationManager = - new ConfigurationManager(CORE_CONFIGURATION_FILE); - } - $this->config = $configurationManager; - - // Configure the application here. - !isset($this->config['cli_task']) or $this->bind('cli', - new $this->config['cli_task']); - isset($this->config['default_task']) ? $this->bind('default', - new $this->config['default_task']) : - $this->bind('default', new RequestHandlerTask()); - } - -} -?> diff --git a/lib/Data/config.ini b/lib/Data/config.ini deleted file mode 100644 index 5b773ce..0000000 --- a/lib/Data/config.ini +++ /dev/null @@ -1,9 +0,0 @@ -# Config file for FaabBB. - -# Default task -default_task = MVC\RequestHandlerTask - -cli_task = Console\ConsoleTask - -# Controller directory -controller_dir = /app/Controllers diff --git a/lib/Data/core.log b/lib/Data/core.log deleted file mode 100644 index e0981a9..0000000 --- a/lib/Data/core.log +++ /dev/null @@ -1,15 +0,0 @@ -Tue, 27 Dec 11 12:03:20 +0000 Core\Application __construct -INFO: FaabBB Framework version 3.010 -Webdevelopment framework written in PHP. -Tue, 27 Dec 11 12:04:02 +0000 Core\Application __construct -INFO: FaabBB Framework version 3.010 -Webdevelopment framework written in PHP. -Tue, 27 Dec 11 12:04:22 +0000 Core\Application __construct -INFO: FaabBB Framework version 3.010 -Webdevelopment framework written in PHP. -Tue, 27 Dec 11 12:04:49 +0000 Core\Application __construct -INFO: FaabBB Framework version 3.010 -Webdevelopment framework written in PHP. -Wed, 25 Jan 12 15:54:58 +0000 Core\Application __construct -INFO: FaabBB Framework version 3.010 -Webdevelopment framework written in PHP. diff --git a/lib/Dispatcher/DispatchResponse.php b/lib/Dispatcher/DispatchResponse.php deleted file mode 100644 index fb5be09..0000000 --- a/lib/Dispatcher/DispatchResponse.php +++ /dev/null @@ -1,45 +0,0 @@ -name = $name; - $this->action = $action; - } - /** - * The name that's found by the {@link Dispatcher}. - * Field should be default, - * when no name is given. - */ - public $name = "default"; - - /** - * The action that's found by the {@link Dispatcher}. - * Field should be default, - * when no action is given. - */ - public $action = "default"; -} diff --git a/lib/Dispatcher/Dispatcher.php b/lib/Dispatcher/Dispatcher.php deleted file mode 100644 index 87235fa..0000000 --- a/lib/Dispatcher/Dispatcher.php +++ /dev/null @@ -1,33 +0,0 @@ -errorHandler = $errorHandler; - $this->exceptionHandler = $exceptionHandler; - } - - /** - * The {@link AbstractErrorHandler} of this class. - */ - protected $errorHandler = null; - - /** - * The {@link AbstractExceptionHandler} of this class. - */ - protected $exceptionHandler = null; - - /** - * Returns the {@link AbstractErrorHandler} of this class. - * - * @since 3.010 - * @return the {@link AbstractErrorHandler} of this class. - */ - public function getErrorHandler() { - return $this->errorHandler; - } - - /** - * Returns the {@link AbstractExceptionHandler} of this class. - * - * @since 3.010 - * @return the {@link AbstractExceptionHandler} of this class. - */ - public function getExceptionHandler() { - return $this->exceptionHandler; - } - - -} -?> diff --git a/lib/Error/AbstractErrorHandler.php b/lib/Error/AbstractErrorHandler.php deleted file mode 100644 index 20f7a51..0000000 --- a/lib/Error/AbstractErrorHandler.php +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/lib/Error/AbstractExceptionHandler.php b/lib/Error/AbstractExceptionHandler.php deleted file mode 100644 index f73bde3..0000000 --- a/lib/Error/AbstractExceptionHandler.php +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/lib/Error/ErrorWrapper.php b/lib/Error/ErrorWrapper.php deleted file mode 100644 index 4d1c0ef..0000000 --- a/lib/Error/ErrorWrapper.php +++ /dev/null @@ -1,94 +0,0 @@ -level = $level; - $this->message = $message; - $this->file = $file; - $this->line = $line; - } - /** - * The level of this error. - */ - protected $level = 0; - - /** - * Returns the level of this error. - * - * @since 3.010 - * @return The level of this error. - */ - public function getLevel() { - return $this->level; - } - - /** - * The message of this error. - */ - protected $message = ""; - - /** - * Returns the message of this error. - * - * @since 3.010 - * @return The message of this error. - */ - public function getMessage() { - return $this->message; - } - - /** - * The file where the error occured. - */ - protected $file = ""; - - /** - * Returns the file where the error occured. - * - * @since 3.010 - * @return The file where the error occured. - */ - public function getFile() { - return $this->file; - } - - /** - * The line number where the error occured. - */ - protected $line = 0; - - /** - * Returns the line number where the error occured. - * - * @since 3.010 - * @return The line number where the error occured. - */ - public function getLine() { - return $this->line; - } - -} diff --git a/lib/Language/IO/InputItem.php b/lib/Language/IO/InputItem.php deleted file mode 100644 index 2a8297f..0000000 --- a/lib/Language/IO/InputItem.php +++ /dev/null @@ -1,103 +0,0 @@ -value = $this->parse($value); - } - - /** - * Parses this value to a correct object. - * - * @version 3.010 - * @param $value The value to parse. - * @return The correct object. - */ - protected function parse($value = "") { - if (!is_string($value)) - return $value; - if ($value == "true") - return true; - else if ($value == "false") - return false; - else if (is_numeric($value)) - return intval($value); - - // TODO: extend - } - - /** - * Get the string value of this {@link InputItem}. - * - * @since 3.010 - * @return the String value of this {@link InputItem}. - */ - public function toString() { - if (!is_string($this->value)) - return ""; - return $value; - } - - /** - * Get the boolean value of this {@link InputItem}. - * - * @since 3.010 - * @return the boolean value of this {@link InputItem}. - */ - public function toBoolean() { - if (!is_bool($this->value)) - return false; - return $value; - } - - /** - * Get the number value of this {@link InputItem}. - * - * @since 3.010 - * @return the number value of this {@link InputItem}. - */ - public function getNumber() { - if (!is_numeric($this->value)) - return 0; - return $value; - } - - /** - * Get the array value of this {@link InputItem}. - * - * @since 3.010 - * @return the array value of this {@link InputItem}. - */ - public function toArray() { - if (!is_array($this->value)) - return array(); - return $value; - } -} diff --git a/lib/Language/IO/InputManager.php b/lib/Language/IO/InputManager.php deleted file mode 100644 index 039ce49..0000000 --- a/lib/Language/IO/InputManager.php +++ /dev/null @@ -1,38 +0,0 @@ - diff --git a/lib/Language/IO/ItemNotExistsException.php b/lib/Language/IO/ItemNotExistsException.php deleted file mode 100644 index c91461a..0000000 --- a/lib/Language/IO/ItemNotExistsException.php +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/lib/Language/Net/HTTP/HttpInputManager.php b/lib/Language/Net/HTTP/HttpInputManager.php deleted file mode 100644 index 8af7699..0000000 --- a/lib/Language/Net/HTTP/HttpInputManager.php +++ /dev/null @@ -1,32 +0,0 @@ -items[] = new InputItem($items); - } - } -} diff --git a/lib/Language/Net/HTTP/HttpRequest.php b/lib/Language/Net/HTTP/HttpRequest.php deleted file mode 100644 index 212e316..0000000 --- a/lib/Language/Net/HTTP/HttpRequest.php +++ /dev/null @@ -1,136 +0,0 @@ -method = $method; - $this->requestURI = $requestURI; - $this->protocol = $protocol; - $this->get = new HttpInputManager($arguments); - $this->post = new HttpInputManager($post); - $this->cookies = new HttpInputManager($cookies); - } - - /** - * Returns the method of this {@link HttpRequest}. - * - * @version 3.010 - * @return The method of this {@link HttpRequest}. - */ - public function getMethod() { - return $this->method; - } - - /** - * Returns the request-URI of this {@link HttpRequest}. - * - * @version 3.010 - * @return The request-URI of this {@link HttpRequest}. - */ - public function getRequestURI() { - return $this->requestURI; - } - - /** - * Returns the protocol of this {@link HttpRequest}. - * - * @version 3.010 - * @return The protocol of this {@link HttpRequest}. - */ - public function getProtocol() { - return $this->protocol; - } - - - /** - * Returns the GET variables of this {@link HttpRequest}. - * - * @since 3.010 - * @return The GET variables of this {@link HttpRequest}. - */ - public function getGetVariables() { - $this->get; - } - - /** - * Returns the POST variables of this {@link HttpRequest}. - * - * @since 3.010 - * @return The POST variables of this {@link HttpRequest}. - */ - public function getPostVariables() { - $this->post; - } - - /** - * Returns the COOKIE variables of this {@link HttpRequest}. - * - * @since 3.010 - * @return The COOKIE variables of this {@link HttpRequest}. - */ - public function getCookies() { - $this->cookies; - } - - -} diff --git a/lib/Language/Net/HTTP/Method.php b/lib/Language/Net/HTTP/Method.php deleted file mode 100644 index fbf4e79..0000000 --- a/lib/Language/Net/HTTP/Method.php +++ /dev/null @@ -1,28 +0,0 @@ -content; - } - - /** - * Returns the length of the content of this {@link Request}. - * - * @since 3.010 - * @return The length of the content of this {@link Request}. - */ - public function getLength() { - return $this->length; - } - -} diff --git a/lib/Language/Runtime.php b/lib/Language/Runtime.php deleted file mode 100644 index a7b178a..0000000 --- a/lib/Language/Runtime.php +++ /dev/null @@ -1,83 +0,0 @@ -properties = $_SERVER; - $this->request = new HttpRequest($this->properties['REQUEST_METHOD'], - $this->properties['REQUEST_URI'], - $this->properties['SERVER_PROTOCOL'], - $_GET, $_POST, $_COOKIE); - } - - /** - * Returns the filename of the currently executing script. - * - * @since 3.010 - * @return The filename of the currently executing script. - */ - public function getSelf() { - return $this->properties['PHP_SELF']; - } - - /** - * Returns the array of arguments passed to the script. When the script - * is run on the command line, - * this gives C-style access to the command line parameters. - * When called via the GET method, this will contain the query string. - * - * @since 3.010 - * @return The array of arguments passed to the script. - */ - public function getArguments() { - return $this->properties['args']; - } - - /** - * Returns the document root directory under which the current script is executing. - * - * @since 3.010 - * @return The document root directory under which the current script is executing. - */ - public function getRoot() { - return $this->properties['DOCUMENT_ROOT']; - } - - /** - * Returns the current {@link HttpRequest} of this {@link Runtime}. - * - * @since 3.010 - * @return The current {@link HttpRequest} of this {@link Runtime}. - */ - public function getRequest() { - return $this->request; - } -} diff --git a/lib/Language/StackFrame.php b/lib/Language/StackFrame.php deleted file mode 100644 index 6dcdde3..0000000 --- a/lib/Language/StackFrame.php +++ /dev/null @@ -1,78 +0,0 @@ -stackFrameArray = $stackFrameArray; - } - - /** - * Returns the current function name. - * - * @since 3.010 - * @return the current function name. - */ - public function getFunctionName() { - return isset($this->stackFrameArray['function']) ? - $this->stackFrameArray['function'] : null; - } - - /** - * Returns the current line number. - * - * @since 3.010 - * @return the current line number. - */ - public function getLine() { - return isset($this->stackFrameArray['line']) ? - $this->stackFrameArray['line'] : -1; - } - - /** - * Returns the current file name. - * - * @since 3.010 - * @return the current file name. - */ - public function getFileName() { - return isset($this->stackFrameArray['file']) ? - $this->stackFrameArray['file'] : null; - } - - /** - * Returns the current class name. - * - * @since 3.010 - * @return the current class name. - */ - public function getClassName() { - return isset($this->stackFrameArray['class']) ? - $this->stackFrameArray['class'] : null; - } - -} diff --git a/lib/Language/StackTrace.php b/lib/Language/StackTrace.php deleted file mode 100644 index 4de3087..0000000 --- a/lib/Language/StackTrace.php +++ /dev/null @@ -1,70 +0,0 @@ -Be aware that $limit = $limit + $skip - */ - public function __construct($skip = 0, $limit = 0) { - $backtrace = debug_backtrace($limit); - - // Remove the call to this class. - array_shift($backtrace); - for ($i = 0; $i < $skip; $i++) { - if ($i >= count($backtrace)) - break; - array_shift($backtrace); - } - - $this->backtrace = $backtrace; - - foreach($backtrace as $frame) { - array_push($this->stackFrames, new StackFrame($frame)); - } - } - - /** - * Get the {@link StackFrame}s of this {@link StackTrace}. - * - * @since 3.010 - * @param $skip The amount of frames to skip first. - * @param $limit The amount of frames that should be returned. - * @return the {@link StackFrame}s of this {@link StackTrace}. - */ - public function getStackFrames($skip = 0, $limit = 0) { - return $limit == 0 ? array_slice($this->stackFrames, $skip) : - array_slice($this->stackFrames, $skip, $limit); - } - - -} -?> diff --git a/lib/Logging/ConsoleHandler.php b/lib/Logging/ConsoleHandler.php deleted file mode 100644 index fe5c441..0000000 --- a/lib/Logging/ConsoleHandler.php +++ /dev/null @@ -1,42 +0,0 @@ -formatter = new SimpleFormatter(); - } - - /** - * Publish the given {@link LogRecord}. - * - * @since 3.010 - * @param $logRecord The {@link LogRecord} to publish. - */ - public function publish($logRecord) { - echo $this->formatter->format($logRecord); - } - -} - ?> diff --git a/lib/Logging/FileHandler.php b/lib/Logging/FileHandler.php deleted file mode 100644 index c0cd7b4..0000000 --- a/lib/Logging/FileHandler.php +++ /dev/null @@ -1,65 +0,0 @@ -formatter = new SimpleFormatter(); - $this->file = $file; - $this->maxSize = $maxSize; - $this->fileStream = @fopen($file, (!is_readable($file) || filesize($file) - > $maxSize ? 'w+' : 'a+')); - if (!$this->fileStream) { - echo 'Failed to access logging file ' . $file . '.'; - } - } - - /** - * Publish the given {@link LogRecord}. - * - * @since 3.010 - * @param $logRecord The {@link LogRecord} to publish. - */ - public function publish($logRecord) { - if ($this->fileStream) - fwrite($this->fileStream, $this->formatter->format($logRecord)); - } - -} - ?> diff --git a/lib/Logging/Formatter.php b/lib/Logging/Formatter.php deleted file mode 100644 index 2f30e5d..0000000 --- a/lib/Logging/Formatter.php +++ /dev/null @@ -1,27 +0,0 @@ - \ No newline at end of file diff --git a/lib/Logging/Handler.php b/lib/Logging/Handler.php deleted file mode 100644 index 81d0cd0..0000000 --- a/lib/Logging/Handler.php +++ /dev/null @@ -1,56 +0,0 @@ -formatter = $formatter; - } - - /** - * Get the {@link Formatter} of this {@link Handler}. - * - * @since 3.010 - * @return the {@link Formatter} of this {@link Handler}. - */ - public function getFormatter() { - return $this->formatter; - } - - /** - * Publish the given {@link LogRecord}. - * - * @since 3.010 - * @param $logRecord The {@link LogRecord} to publish. - */ - public abstract function publish($logRecord); - -} - ?> \ No newline at end of file diff --git a/lib/Logging/Level.php b/lib/Logging/Level.php deleted file mode 100644 index f19d151..0000000 --- a/lib/Logging/Level.php +++ /dev/null @@ -1,109 +0,0 @@ - - *
  • SEVERE (highest value)
  • - *
  • WARNING
  • - *
  • INFO
  • - *
  • CONFIG
  • - *
  • FINE
  • - *
  • FINER
  • - *
  • FINEST (lowest value)
  • - * - * - * - * @category logging - * @version 3.010 - * @since 3.010 - * @copyright Copyright © 2011, FaabTech - * @author Fabian M. - */ -class Level { - /** - * {@link Level#OFF} is a special level that can be used to turn off logging. - * This level is initialized to {@link Number#MAX_VALUE} - */ - public static $OFF = array('name' => 'OFF', 'value' => PHP_INT_MAX); - - /** - * {@link Level#SEVERE} is a message level indicating a serious failure. In - * general {@link Level#SEVERE} messages should describe events that are of - * considerable importance and which will prevent normal program execution. They - * should be reasonably intelligible to end users and to system administrators. - * This level is initialized to 1000. - */ - public static $SEVERE = array('name' => 'SEVERE', 'value' => 1000); - - /** - * {@link Level#WARNING} is a message level indicating a potential problem. In - * general {@link Level#WARNING} messages should describe events that will be of - * interest to end users or system managers, or which indicate potential - * problems. This level is initialized to 900. - */ - public static $WARNING = array('name' => 'WARNING', 'value' => 900); - - /** - * {@link Level#INFO} is a message level for informational messages. Typically - * {@link Level#INFO} messages will be written to the console or its equivalent. - * So the {@link Level#INFO} level should only be used for reasonably - * significant messages that will make sense to end users and system admins. - * This level is initialized to 800. - */ - public static $INFO = array('name' => 'INFO', 'value' => 800); - - /** - * {@link Level#CONFIG} is a message level for static configuration messages. - * {@link Level#CONFIG} messages are intended to provide a variety of static - * configuration information, to assist in debugging problems that may be - * associated with particular configurations. For example, {@link Level#CONFIG} - * message might include the CPU type, the graphics depth, the GUI - * look-and-feel, etc. This level is initialized to 700. - */ - public static $CONFIG = array('name' => 'CONFIG', 'value' => 700); - - /** - * {@link Level#FINE} is a message level providing tracing information. All of - * {@link Level#FINE}, {@link Level#FINER}, and {@link Level#FINEST} are - * intended for relatively detailed tracing. T The exact meaning of the three - * levels will vary between subsystems, but in general, {@link Level#FINEST} - * should be used for the most voluminous detailed output, {@link Level#FINER} - * for somewhat less detailed output, and {@link Level#FINE} for the lowest - * volume (and most important) messages. In general the {@link Level#FINE} level - * should be used for information that will be broadly interesting to developers - * who do not have a specialized interest in the specific subsystem. - * {@link Level#FINE} messages might include things like minor (recoverable) - * failures. Issues indicating potential performance problems are also worth - * logging as {@link Level#FINE}. This level is initialized to 500. - */ - public static $FINE = array('name' => 'FINE', 'value' => 500); - /** - * {@link Level#FINER} indicates a fairly detailed tracing message. By default - * logging calls for entering, returning, or throwing an exception are traced at - * this level. This level is initialized to 400. - */ - public static $FINER = array('name' => 'FINER', 'value' => 400); - /** - * {@link Level#FINEST} indicates a highly detailed tracing message. This level - * is initialized to 300. - */ - public static $FINEST = array('name' => 'FINEST', 'value' => 300); - /** - * {@link Level#ALL} indicates that all messages should be logged. This level is - * initialized to {@link Number#MIN_VALUE} - */ - public static $ALL = array('name' => 'FINEST', 'value' => PHP_INT_SIZE); - - -} - -?> diff --git a/lib/Logging/LogRecord.php b/lib/Logging/LogRecord.php deleted file mode 100644 index 9afa1b4..0000000 --- a/lib/Logging/LogRecord.php +++ /dev/null @@ -1,118 +0,0 @@ - 'INFO', 'value' => 800); - - /** - * The message of this {@link LogRecord}. - */ - protected $message = ""; - - /** - * The {@link StackFrame}s of this {@link LogRecord}. - */ - protected $stackframes = array(); - /** - * Constructs a new {@link LogRecord}. - * - * @since 3.010 - * @param $level The {@link Level} of this {@link LogRecord}. - * @param $msg The message of this {@link LogRecord}. - * @param $stackframes The {@link StackFrame}s of this {@link LogRecord}. - */ - public function __construct($level, $msg, $stackframes = array()) { - if (!is_array($level) || !is_array($stackframes)) { - return; - } - - $this->level = $level; - $this->message = $msg; - $this->stackframes = $stackframes; - } - - /** - * Get the {@link Level} of this {@link LogRecord}. - * - * @since 3.010 - * @return The {@link Level} of this {@link LogRecord}. - */ - public function getLevel() { - return $this->level; - } - - /** - * Set the {@link Level} of this {@link LogRecord}. - * - * @since 3.010 - * @param $level The {@link Level} to set. - */ - public function setLevel($level) { - !is_array($level) or ($this->level = $level); - } - - /** - * Get the message of this {@link LogRecord}. - * - * @since 3.010 - * @return The message of this {@link LogRecord}. - */ - public function getMessage() { - return $this->message; - } - - /** - * Set the message of this {@link LogRecord}. - * - * @since 3.010 - * @param $msg The message to set. - */ - public function setMessage($msg) { - $this->msg = $msg; - } - - /** - * Get the {@link StackFrame}s of this {@link LogRecord}. - * - * @since 3.010 - * @return The {@link StackFrame}s of this {@link LogRecord}. - */ - public function getStackFrames() { - return $this->stackframes; - } - - /** - * Set the {@link StackFrame}s of this {@link LogRecord}. - * - * @since 3.010 - * @param $stackframes The {@link StackFrame}s to set. - */ - public function setStackFrames($stackframes) { - !is_array($stackframes) or ($this->stackframes = $stackframes); - } - - - - -} -?> \ No newline at end of file diff --git a/lib/Logging/Logger.php b/lib/Logging/Logger.php deleted file mode 100644 index e2abbc4..0000000 --- a/lib/Logging/Logger.php +++ /dev/null @@ -1,246 +0,0 @@ -name = $name; - $this->levelValue = Level::$INFO['value']; - } - - /** - * Add a {@link Handler} to this {@link Logger}. - * - * @since 3.010 - * @param $handler The {@link Handler} to add. - */ - public function addHandler($handler) { - array_push($this->handlers, $handler); - } - - /** - * Get the {@link Handler}s of this {@link Logger}. - * - * @since 3.010 - * @return the {@link Handler}s of this {@link Logger}. - */ - public function getHandlers() { - return $this->handlers; - } - - /** - * Set the {@link Level} of this {@link Logger}. - * - * @since 3.010 - * @param $Level The {@link Level} to set. - */ - public function setLevel($level) { - $this->levelValue = $level['value']; - } - - /** - * Get the {@link Level} of this {@link Logger}. - * - * @since 3.010 - * @return the {@link Level} of this {@link Logger}. - */ - public function getLevel() { - return $this->levelValue; - } - - /** - * Log a {@link LogRecord}. - * All the other logging methods in this class call through this method to actually perform any logging. - * Subclasses can override this single method to capture all log activity. - * - * @param record The {@link LogRecord} to be published. - */ - protected function log($record, $msg = null) { - if ($msg == null) { - // String is given. - if (is_string($record)) { - $s = new StackTrace(1, 0); - $record = new LogRecord(Level::$INFO, $record, $s->getStackFrames()); - } - $l = $record->getLevel(); - if ($l['value'] < $this->levelValue || - $this->levelValue == Level::$OFF['value']) { - return; - } - - foreach ($this->handlers as $handler) { - $handler->publish($record); - } - } else { - $s = new StackTrace(2, 0); - $this->log(new LogRecord($record, $msg, $s->getStackFrames())); - } - } - - /** - * Log a {@link Level#SEVERE} message. - * If the logger is currently enabled for the {@link Level#SEVERE} message level then the given message is - * forwarded to all the registered output {@link Handler} objects. - * - * @param msg The string message (or a key in the message catalog) - */ - public function severe($msg) { - $l = Level::$SEVERE; - if ($l['value'] < $this->levelValue) { - return; - } - - $this->log(Level::$SEVERE, $msg); - } - - /** - * Log a {@link Level#WARNING} message. - * If the logger is currently enabled for the {@link Level#WARNING} message level then the given message is - * forwarded to all the registered output {@link Handler} objects. - * - * @param msg The string message (or a key in the message catalog) - */ - public function warning($msg) { - $l = Level::$WARNING; - if ($l['value'] < $this->levelValue) { - return; - } - - $this->log(Level::$WARNING, $msg); - } - /** - * Log a {@link Level#INFO} message. - * If the logger is currently enabled for the {@link Level#INFO} message level then the given message is - * forwarded to all the registered output {@link Handler} objects. - * - * @param msg The string message (or a key in the message catalog) - */ - public function info($msg) { - $l = Level::$INFO; - if ($l['value'] < $this->levelValue) { - return; - } - - $this->log(Level::$INFO, $msg); - } - /** - * Log a {@link Level#CONFIG} message. - * If the logger is currently enabled for the {@link Level#CONFIG} message level then the given message is - * forwarded to all the registered output {@link Handler} objects. - * - * @param msg The string message (or a key in the message catalog) - */ - public function config($msg) { - $l = Level::$CONFIG; - if ($l['value'] < $this->levelValue) { - return; - } - - $this->log(Level::$CONFIG, $msg); - } - /** - * Log a {@link Level#FINE} message. - * If the logger is currently enabled for the {@link Level#FINE} message level then the given message is - * forwarded to all the registered output {@link Handler} objects. - * - * @param msg The string message (or a key in the message catalog) - */ - public function fine($msg) { - $l = Level::$FINE; - if ($l['value'] < $this->levelValue) { - return; - } - - $this->log(Level::$FINE, $msg); - } - /** - * Log a {@link Level#FINER} message. - * If the logger is currently enabled for the {@link Level#FINER} message level then the given message is - * forwarded to all the registered output {@link Handler} objects. - * - * @param msg The string message (or a key in the message catalog) - */ - public function finer($msg) { - $l = Level::$FINER; - if ($l['value'] < $this->levelValue) { - return; - } - - $this->log(Level::$FINER, $msg); - } - - /** - * Log a {@link Level#FINEST} message. - * If the logger is currently enabled for the {@link Level#FINEST} message level then the given message is - * forwarded to all the registered output {@link Handler} objects. - * - * @param msg The string message (or a key in the message catalog) - */ - public function finest($msg) { - $l = Level::$FINEST; - if ($l['value'] < $this->levelValue) { - return; - } - - $this->log(Level::$FINEST, $msg); - } - - -} -?> diff --git a/lib/Logging/SimpleFormatter.php b/lib/Logging/SimpleFormatter.php deleted file mode 100644 index 77cffd9..0000000 --- a/lib/Logging/SimpleFormatter.php +++ /dev/null @@ -1,48 +0,0 @@ - - * Dec 6, 2011 4:20:10 PM myClass doSomething - * SEVERE: this is severe - * - * - * @category logging - * @version 3.010 - * @since 3.010 - * @copyright Copyright © 2011, FaabTech - * @author Fabian M. - */ -class SimpleFormatter implements Formatter { - - /** - * Formats the given {@link LogRecord} - * - * @since 3.010 - * @param $logRecord The {@link LogRecord} to format. - */ - public function format($logRecord) { - $stackFrames = $logRecord->getStackFrames(); - $stackFrame = $stackFrames[0]; - $className = isset($stackFrame) ? $stackFrame->getClassName() : ""; - $functionName = isset($stackFrame) ? $stackFrame->getFunctionName() : ""; - $level = $logRecord->getLevel(); - - - $str = gmdate(DATE_RFC822) . ' ' . $className . ' ' . - $functionName . "\n" . $level['name'] . ': ' . $logRecord->getMessage() . - "\n"; - - return $str; - } - -} - ?> \ No newline at end of file diff --git a/lib/MVC/Controller.php b/lib/MVC/Controller.php deleted file mode 100644 index 9fa23e4..0000000 --- a/lib/MVC/Controller.php +++ /dev/null @@ -1,43 +0,0 @@ -$this->action_default(); - * - * @category mvc - * @version 3.010 - * @since 3.010 - * @copyright Copyright © 2011, FaabTech - * @author Fabian M. - */ -class Controller { - /** - * The {@link Application} that is using this {@link Controller}. - */ - protected $application = null; - - /** - * Constructs a new {@link Controller}. - * - * @param $application The {@link Application} of this {@link Controller}. - */ - public function __construct($application) { - $this->application = $application; - } - - /** - * The default action that's called when no action - * is given. - */ - public function action_default() { - - } - -} diff --git a/lib/MVC/RequestHandlerTask.php b/lib/MVC/RequestHandlerTask.php deleted file mode 100644 index df8335e..0000000 --- a/lib/MVC/RequestHandlerTask.php +++ /dev/null @@ -1,24 +0,0 @@ -