X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmiddleware%2Fcompressor%2Fclass_CompressorChannel.php;h=51ea53e2def0ee2cdc14d9b8e7691e4fb0b537c7;hb=b44e5e7347f9a1dbd49b5b47d506a4f6526caf2f;hp=1b33041fd86b45946f8f2c8ca801f818e38fe4af;hpb=11c0ba60cb6c044928f41e93cc98d214b1d8ad7c;p=shipsimu.git diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php index 1b33041..51ea53e 100644 --- a/inc/classes/middleware/compressor/class_CompressorChannel.php +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -2,7 +2,7 @@ /** * Middleware class for selecting the right compressor channel * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version @@ -22,10 +22,16 @@ * along with this program. If not, see . */ class CompressorChannel extends BaseMiddleware { - // Output handler instance + /** + * Real compressor instance + */ private $compressor = null; - // Public constructor + /** + * Protected constructor + * + * @return void + */ protected function __construct () { // Call parent constructor! parent::__construct(__CLASS__); @@ -34,10 +40,16 @@ class CompressorChannel extends BaseMiddleware { $this->setObjectDescription("Komprimierungshandler"); // Create an unique ID - $this->createUniqueID(); + $this->generateUniqueId(); } - // Create a new compressor channel based a given compression handler + /** + * Create a new compressor channel based a given base directory where + * we shall look for compressor classes + * + * @param $baseDir Directory which holds our compressor classes + * @return $cInstance A prepared instance of this class + */ public final static function createCompressorChannel ($baseDir) { // Get new instance $cInstance = new CompressorChannel(); @@ -53,7 +65,7 @@ class CompressorChannel extends BaseMiddleware { $dirPointer = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($baseDir); // Read all directories but no sub directories - while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess"))) { + while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess", ".svn"))) { // Is this a class file? if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == FrameworkConfiguration::getInstance()->readConfig('php_extension'))) { // Get the compressor's name. That's why you must name @@ -98,8 +110,8 @@ class CompressorChannel extends BaseMiddleware { || (!method_exists($cInstance->getCompressor(), 'compressStream')) || (!method_exists($cInstance->getCompressor(), 'decompressStream')) ) { - // Set the null compressor handler - $cInstance->setCompressor(NullCompressor::createNullCompressor()); + // Set the null compressor handler. This should not be configureable! + $cInstance->setCompressor(ObjectFactory::createObjectByName('NullCompressor')); } // Return the compressor instance