This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/zendframework/zf2 into zf…
…-3371
- Loading branch information
JustinV
committed
Jan 30, 2013
65 parents
216ac0e
+
aecb8f4
+
ef44cf1
+
bc4610b
+
8c773ad
+
0481606
+
d1304e2
+
d3d5a56
+
533570c
+
6e30cb0
+
82c88d1
+
88c4f3b
+
c96ebb3
+
f0320b1
+
cb0afaa
+
128be4b
+
34cd6a3
+
ec2aab9
+
809bd88
+
77026e3
+
c2796da
+
0ee8602
+
bf4e728
+
cd33c2d
+
32497e5
+
79eb7d0
+
8cc5d58
+
869ab1c
+
436e613
+
ab7d56c
+
6dbeef6
+
84670b1
+
cccfba9
+
2717653
+
b4dd364
+
460818e
+
b5ac15d
+
2d218aa
+
046d669
+
5597f80
+
98dc299
+
01b3149
+
b0177b5
+
74f8270
+
62799e5
+
512426e
+
5a9a928
+
3b3e691
+
6f57ae9
+
116cf37
+
bb991fd
+
1ce1893
+
5000327
+
32beb38
+
fe88f0e
+
49921e6
+
6387996
+
9623b87
+
fef33e6
+
a55293c
+
37a7d0c
+
aeda378
+
1681df7
+
8557890
+
14b10f4
commit 07f05df
Showing
79 changed files
with
1,598 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link https://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Filter\Compress; | ||
|
||
use Zend\Filter\Exception; | ||
|
||
/** | ||
* Compression adapter for php snappy (http://code.google.com/p/php-snappy/) | ||
*/ | ||
class Snappy implements CompressionAlgorithmInterface | ||
{ | ||
/** | ||
* Class constructor | ||
* | ||
* @param null|array|\Traversable $options (Optional) Options to set | ||
* @throws Exception\ExtensionNotLoadedException if snappy extension not loaded | ||
*/ | ||
public function __construct($options = null) | ||
{ | ||
if (!extension_loaded('snappy')) { | ||
throw new Exception\ExtensionNotLoadedException('This filter needs the snappy extension'); | ||
} | ||
} | ||
|
||
/** | ||
* Compresses the given content | ||
* | ||
* @param string $content | ||
* @return string | ||
* @throws Exception\RuntimeException on memory, output length or data warning | ||
*/ | ||
public function compress($content) | ||
{ | ||
$compressed = snappy_compress($content); | ||
|
||
if ($compressed === false) { | ||
throw new Exception\RuntimeException('Error while compressing.'); | ||
} | ||
|
||
return $compressed; | ||
} | ||
|
||
/** | ||
* Decompresses the given content | ||
* | ||
* @param string $content | ||
* @return string | ||
* @throws Exception\RuntimeException on memory, output length or data warning | ||
*/ | ||
public function decompress($content) | ||
{ | ||
$compressed = snappy_uncompress($content); | ||
|
||
if ($compressed === false) { | ||
throw new Exception\RuntimeException('Error while decompressing.'); | ||
} | ||
|
||
return $compressed; | ||
} | ||
|
||
/** | ||
* Returns the adapter name | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Snappy'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.