Rewritten static 'create' method in all compressors, some code-cleanup
authorRoland Häder <roland@mxchange.org>
Sat, 12 Mar 2011 00:07:02 +0000 (00:07 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 12 Mar 2011 00:07:02 +0000 (00:07 +0000)
inc/classes/main/compressor/class_Bzip2Compressor.php
inc/classes/main/compressor/class_GzipCompressor.php
inc/classes/main/compressor/class_NullCompressor.php

index 665bfb4..1b3824f 100644 (file)
@@ -35,20 +35,20 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
        /**
         * Create a new compressor channel based a given compression handler
         *
-        * @return      $cInstance      An instance of this class
+        * @return      $compressorInstance             An instance of this class
         */
        public static final function createBzip2Compressor () {
+               // Routines not found by default
+               $compressorInstance = null;
+
                // Get new instance
                if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) {
                        // Compressor can maybe be used
-                       $cInstance = new Bzip2Compressor();
-               } else {
-                       // Routines not found!
-                       $cInstance = null;
-               }
+                       $compressorInstance = new Bzip2Compressor();
+               } // END - if
 
                // Return the compressor instance
-               return $cInstance;
+               return $compressorInstance;
        }
 
        /**
@@ -62,7 +62,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
                if (is_object($streamData)) {
                        // Throw an exception
                        throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               }
+               } // END - if
 
                // Return the compressed stream
                return bzcompress($streamData, 1);
@@ -79,7 +79,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
                if (is_object($streamData)) {
                        // Throw an exception
                        throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               }
+               } // END - if
 
                // Return the decompressed stream
                return bzdecompress($streamData);
@@ -91,7 +91,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
         * @return      $string         Returns always "bz2"
         */
        public final function getCompressorExtension () {
-               return "bz2";
+               return 'bz2';
        }
 }
 
index 87894bd..f69f426 100644 (file)
@@ -35,20 +35,20 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
        /**
         * Create a new compressor channel based a given compression handler
         *
-        * @return      $cInstance      An instance of this class
+        * @return      $compressorInstance             An instance of this class
         */
        public static final function createGzipCompressor () {
+               // Routines not found by default
+               $compressorInstance = null;
+
                // Get new instance
                if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) {
                        // Compressor can maybe be used
-                       $cInstance = new GzipCompressor();
-               } else {
-                       // Routines not found!
-                       $cInstance = null;
-               }
+                       $compressorInstance = new GzipCompressor();
+               } // END - if
 
                // Return the compressor instance
-               return $cInstance;
+               return $compressorInstance;
        }
 
        /**
@@ -62,7 +62,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
                if (is_object($streamData)) {
                        // Throw an exception
                        throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               }
+               } // END - if
 
                // Return the compressed stream
                return gzcompress($streamData, 1);
@@ -79,7 +79,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
                if (is_object($streamData)) {
                        // Throw an exception
                        throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               }
+               } // END - if
 
                // Return the decompressed stream
                return gzuncompress($streamData);
index 36f96d9..c03b5a3 100644 (file)
@@ -35,14 +35,14 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
        /**
         * Create a new compressor channel based a given compression handler
         *
-        * @return      $cInstance      An instance of this class
+        * @return      $compressorInstance             An instance of this class
         */
        public static final function createNullCompressor () {
                // Get new instance
-               $cInstance = new NullCompressor();
+               $compressorInstance = new NullCompressor();
 
                // Return the compressor instance
-               return $cInstance;
+               return $compressorInstance;
        }
 
        /**
@@ -56,7 +56,7 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
                if (is_object($streamData)) {
                        // Throw an exception
                        throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               }
+               } // END - if
 
                // Return the compressed stream
                return $streamData;
@@ -73,7 +73,7 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
                if (is_object($streamData)) {
                        // Throw an exception
                        throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               }
+               } // END - if
 
                // Return the decompressed stream
                return $streamData;
@@ -85,7 +85,7 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
         * @return      $string         Returns always "null"
         */
        public final function getCompressorExtension () {
-               return "null";
+               return 'null';
        }
 }