]> git.mxchange.org Git - core.git/commitdiff
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 665bfb4e4f0b435d23ca625564ec510847b6e7e6..1b3824f80038642263365dbd54d82c5acfdcdec1 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 87894bd82ce87fa7c0be9911721f9e07c8144c01..f69f4260ea9a74756ed880ccbbb9a437c555defb 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 36f96d934b99cabd0929d257ff9768d0b2806a38..c03b5a3934902ace12b8b100b394e5c55cc7826e 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';
        }
 }