Continued:
[core.git] / framework / main / middleware / compressor / class_CompressorChannel.php
index 8ec776d9c935ac8ff3c0d883540d1d0a94867606..a78bb6e82786d2d662e4e4db8d78da9cf14b6823 100644 (file)
@@ -3,8 +3,9 @@
 namespace Org\Mxchange\CoreFramework\Middleware\Compressor;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Compressor\Compressor;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Middleware\BaseMiddleware;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 
@@ -13,7 +14,7 @@ use Org\Mxchange\CoreFramework\Registry\Registerable;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -41,7 +42,7 @@ class CompressorChannel extends BaseMiddleware implements Registerable {
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor!
                parent::__construct(__CLASS__);
        }
@@ -62,18 +63,16 @@ class CompressorChannel extends BaseMiddleware implements Registerable {
                ) {
                        // Init base directory
                        $baseDir =
-                               $compressorInstance->getConfigInstance()->getConfigEntry('framework_base_path') .
-                               $compressorInstance->getConfigInstance()->getConfigEntry('compressor_base_path');
+                               FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('framework_base_path') .
+                               FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('compressor_base_path');
 
                        // Get a directory pointer
                        $directoryInstance = ObjectFactory::createObjectByConfiguredName('directory_class', array($baseDir));
 
                        // Read all directories but no sub directories, .htaccess files and NullCompressor class
-                       while ($directoryEntry = $directoryInstance->readDirectoryExcept(array('.htaccess', 'class_NullCompressor.php'))) {
-                               // Debug message
-                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('COMPRESSOR[' . __METHOD__ . ':' . __LINE__ . ']: directoryEntry=' . $directoryEntry);
-
+                       while ($directoryEntry = $directoryInstance->readDirectoryExcept(array('class_NullCompressor.php'))) {
                                // Is this a class file?
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage('COMPRESSOR: directoryEntry=' . $directoryEntry);
                                if ((substr($directoryEntry, 0, 6) == 'class_') && (substr($directoryEntry, -4, 4) == '.php')) {
                                        /* Get the compressor's name. That's why you must name
                                         * your files like your classes and also that's why you
@@ -97,19 +96,19 @@ class CompressorChannel extends BaseMiddleware implements Registerable {
                                        if (is_null($tempInstance)) {
                                                // Then skip to the next one
                                                continue;
-                                       } // END - if
+                                       }
 
                                        // Set the compressor
                                        $compressorInstance->setCompressor($tempInstance);
 
                                        // No more searches required because we have found a valid compressor stream
                                        break;
-                               } // END - if
-                       } // END - while
+                               }
+                       }
 
                        // Close the directory
                        $directoryInstance->closeDirectory();
-               } // END - if
+               }
 
                // Check again if there is a compressor
                if (
@@ -120,7 +119,7 @@ class CompressorChannel extends BaseMiddleware implements Registerable {
                        // Set the null compressor handler. This should not be configureable!
                        // @TODO Is there a configurable fall-back compressor needed, or is NullCompressor okay?
                        $compressorInstance->setCompressor(ObjectFactory::createObjectByName('Org\Mxchange\CoreFramework\Compressor\Null\NullCompressor'));
-               } // END - if
+               }
 
                // Return the compressor instance
                return $compressorInstance;