projects
/
core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4bbb4bc
)
Rewritten static 'create' method in all compressors, some code-cleanup
author
Roland Häder
<roland@mxchange.org>
Sat, 12 Mar 2011 00:07:02 +0000
(
00:07
+0000)
committer
Roland Häder
<roland@mxchange.org>
Sat, 12 Mar 2011 00:07:02 +0000
(
00:07
+0000)
inc/classes/main/compressor/class_Bzip2Compressor.php
patch
|
blob
|
history
inc/classes/main/compressor/class_GzipCompressor.php
patch
|
blob
|
history
inc/classes/main/compressor/class_NullCompressor.php
patch
|
blob
|
history
diff --git
a/inc/classes/main/compressor/class_Bzip2Compressor.php
b/inc/classes/main/compressor/class_Bzip2Compressor.php
index 665bfb4e4f0b435d23ca625564ec510847b6e7e6..1b3824f80038642263365dbd54d82c5acfdcdec1 100644
(file)
--- a/
inc/classes/main/compressor/class_Bzip2Compressor.php
+++ b/
inc/classes/main/compressor/class_Bzip2Compressor.php
@@
-35,20
+35,20
@@
class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
/**
* Create a new compressor channel based a given compression handler
*
/**
* Create a new compressor channel based a given compression handler
*
- * @return $c
Instance
An instance of this class
+ * @return $c
ompressorInstance
An instance of this class
*/
public static final function createBzip2Compressor () {
*/
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
// 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 the compressor instance
- return $cInstance;
+ return $c
ompressor
Instance;
}
/**
}
/**
@@
-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);
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);
// 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);
if (is_object($streamData)) {
// Throw an exception
throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
- }
+ }
// END - if
// Return the decompressed stream
return bzdecompress($streamData);
// 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 $string Returns always "bz2"
*/
public final function getCompressorExtension () {
- return
"bz2"
;
+ return
'bz2'
;
}
}
}
}
diff --git
a/inc/classes/main/compressor/class_GzipCompressor.php
b/inc/classes/main/compressor/class_GzipCompressor.php
index 87894bd82ce87fa7c0be9911721f9e07c8144c01..f69f4260ea9a74756ed880ccbbb9a437c555defb 100644
(file)
--- a/
inc/classes/main/compressor/class_GzipCompressor.php
+++ b/
inc/classes/main/compressor/class_GzipCompressor.php
@@
-35,20
+35,20
@@
class GzipCompressor extends BaseFrameworkSystem implements Compressor {
/**
* Create a new compressor channel based a given compression handler
*
/**
* Create a new compressor channel based a given compression handler
*
- * @return $c
Instance
An instance of this class
+ * @return $c
ompressorInstance
An instance of this class
*/
public static final function createGzipCompressor () {
*/
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
// 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 the compressor instance
- return $cInstance;
+ return $c
ompressor
Instance;
}
/**
}
/**
@@
-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);
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);
// 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);
if (is_object($streamData)) {
// Throw an exception
throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
- }
+ }
// END - if
// Return the decompressed stream
return gzuncompress($streamData);
// Return the decompressed stream
return gzuncompress($streamData);
diff --git
a/inc/classes/main/compressor/class_NullCompressor.php
b/inc/classes/main/compressor/class_NullCompressor.php
index 36f96d934b99cabd0929d257ff9768d0b2806a38..c03b5a3934902ace12b8b100b394e5c55cc7826e 100644
(file)
--- a/
inc/classes/main/compressor/class_NullCompressor.php
+++ b/
inc/classes/main/compressor/class_NullCompressor.php
@@
-35,14
+35,14
@@
class NullCompressor extends BaseFrameworkSystem implements Compressor {
/**
* Create a new compressor channel based a given compression handler
*
/**
* Create a new compressor channel based a given compression handler
*
- * @return $c
Instance
An instance of this class
+ * @return $c
ompressorInstance
An instance of this class
*/
public static final function createNullCompressor () {
// Get new instance
*/
public static final function createNullCompressor () {
// Get new instance
- $cInstance = new NullCompressor();
+ $c
ompressor
Instance = new NullCompressor();
// Return the compressor instance
// Return the compressor instance
- return $cInstance;
+ return $c
ompressor
Instance;
}
/**
}
/**
@@
-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);
if (is_object($streamData)) {
// Throw an exception
throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
- }
+ }
// END - if
// Return the compressed stream
return $streamData;
// 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);
if (is_object($streamData)) {
// Throw an exception
throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
- }
+ }
// END - if
// Return the decompressed stream
return $streamData;
// 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 $string Returns always "null"
*/
public final function getCompressorExtension () {
- return
"null"
;
+ return
'null'
;
}
}
}
}