]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/middleware/compressor/class_CompressorChannel.php
Just a space removed
[shipsimu.git] / inc / classes / middleware / compressor / class_CompressorChannel.php
index 51ea53e2def0ee2cdc14d9b8e7691e4fb0b537c7..346538024f1b8d6ac3f8ff8e6f615bba785bfe9a 100644 (file)
@@ -6,7 +6,7 @@
  * @version            0.0.0
  * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.ship-simu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class CompressorChannel extends BaseMiddleware {
+class CompressorChannel extends BaseMiddleware implements Registerable {
        /**
         * Real compressor instance
         */
@@ -73,35 +73,20 @@ class CompressorChannel extends BaseMiddleware {
                                        // must keep on class in one file.
                                        $class = substr($dir, 6, -4);
 
-                                       // Create eval command
-                                       $eval = sprintf("\$tempInstance = %s::create%s();",
-                                               $class,
-                                               $class
-                                       );
+                                       // Get an instance from our object factory
+                                       $tempInstance = ObjectFactory::createObjectByName($class);
 
-                                       // Debug message
-                                       if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
-                                               $cInstance->__toString(),
-                                               htmlentities($eval)
-                                       ));
+                                       // Set the compressor
+                                       $cInstance->setCompressor($tempInstance);
 
-                                       // Run it. This will create an instance to the current class
-                                       eval($eval);
-
-                                       // Is the instance valid? We have the stream handler here
-                                       if ((!is_null($tempInstance)) && (method_exists($tempInstance, 'compressStream')) && (method_exists($tempInstance, 'decompressStream'))) {
-                                               // Okay, this handler is valid
-                                               $cInstance->setCompressor($tempInstance);
-
-                                               // No more searches required because we have found a valid compressor stream
-                                               break;
-                                       }
-                               }
-                       }
+                                       // No more searches required because we have found a valid compressor stream
+                                       break;
+                               } // END - if
+                       } // END - while
 
                        // Close the directory
                        $dirPointer->closeDirectory();
-               }
+               } // END - if
 
                // Check again if there is a compressor
                if (
@@ -112,7 +97,7 @@ class CompressorChannel extends BaseMiddleware {
                ) {
                        // Set the null compressor handler. This should not be configureable!
                        $cInstance->setCompressor(ObjectFactory::createObjectByName('NullCompressor'));
-               }
+               } // END - if
 
                // Return the compressor instance
                return $cInstance;