From 6ea45449c5eaed1a37f2a33009a66c672444a333 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 23 Feb 2017 20:52:00 +0100 Subject: [PATCH] Continued: - added "import" for BaseMiddleware class - changed one-line comment to doc-tag as this is propper here MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../compressor/class_CompressorChannel.php | 1 + .../database/class_DatabaseConnection.php | 45 ++++++++++++++----- .../debug/class_DebugMiddleware.php | 1 + .../middleware/io/class_FileIoHandler.php | 1 + 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/inc/main/middleware/compressor/class_CompressorChannel.php b/inc/main/middleware/compressor/class_CompressorChannel.php index 4adb945a..1e5cdbc9 100644 --- a/inc/main/middleware/compressor/class_CompressorChannel.php +++ b/inc/main/middleware/compressor/class_CompressorChannel.php @@ -4,6 +4,7 @@ namespace CoreFramework\Channel\Compressor; // Import framework stuff use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Middleware\BaseMiddleware; /** * Middleware class for selecting the right compressor channel diff --git a/inc/main/middleware/database/class_DatabaseConnection.php b/inc/main/middleware/database/class_DatabaseConnection.php index b695c867..d6e847cc 100644 --- a/inc/main/middleware/database/class_DatabaseConnection.php +++ b/inc/main/middleware/database/class_DatabaseConnection.php @@ -4,6 +4,7 @@ namespace CoreFramework\Connection\Database; // Import framework stuff use CoreFramework\Registry\Registerable; +use CoreFramework\Middleware\BaseMiddleware; /** * Database selector class @@ -32,29 +33,36 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re * Array for connection data */ private $connectData = array( - 'login' => '', - 'pass' => '', - 'dbase' => '', - 'host' => '' + 'login' => '', + 'pass' => '', + 'dbase' => '', + 'host' => '' ); - // The real database layer + /** + * The real database layer + */ private $dbLayer = NULL; - // An instance of this class + /** + * An instance of this class + */ private static $selfInstance = NULL; /** * Protected constructor - * - * @return void */ protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); } - // Create new database connection layer + /** + * Creates a new database connection layer + * + * @param $debugInstance An instance of a DebugMiddleware class + * @param $dbLayer An instance of a DatabaseBackend class + */ public static final function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseBackend $dbLayer) { // Get instance $databaseInstance = new DatabaseConnection(); @@ -69,13 +77,26 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re return $databaseInstance; } - // Get an instance of this class + /** + * Getter for this class + * + * @return $selfInstance An instance of this class + */ public static final function getSelfInstance () { return self::$selfInstance; } - // Public setter for database connection - public final function setConnectionData ($login, $pass, $dbase, $host='localhost') { + /** + * Setter for all database connection data. All these parameters may be + * supported by the underlaying backend. + * + * @param $login Login name to database + * @param $pass Passwort for above login + * @param $dbase Name of used database + * @param $host Host to connect to (default: 127.0.0.1) + * @return void + */ + public final function setConnectionData ($login, $pass, $dbase, $host = '127.0.0.1') { // Transfer connection data $this->connectData['login'] = (string) $login; $this->connectData['pass'] = (string) $pass; diff --git a/inc/main/middleware/debug/class_DebugMiddleware.php b/inc/main/middleware/debug/class_DebugMiddleware.php index 19ebd395..81948737 100644 --- a/inc/main/middleware/debug/class_DebugMiddleware.php +++ b/inc/main/middleware/debug/class_DebugMiddleware.php @@ -4,6 +4,7 @@ namespace CoreFramework\Middleware\Debug; // Import framework stuff use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Middleware\BaseMiddleware; /** * The middlware debug output system. A *real* or concrete output class shall diff --git a/inc/main/middleware/io/class_FileIoHandler.php b/inc/main/middleware/io/class_FileIoHandler.php index 26e19f6c..75d0af5e 100644 --- a/inc/main/middleware/io/class_FileIoHandler.php +++ b/inc/main/middleware/io/class_FileIoHandler.php @@ -5,6 +5,7 @@ namespace CoreFramework\Handler\Filesystem; // Import framework stuff use CoreFramework\Factory\ObjectFactory; use CoreFramework\Generic\FrameworkInterface; +use CoreFramework\Middleware\BaseMiddleware; /** * This is a file IO handler. It handles reading from and writing to files. -- 2.39.5