Completed
Push — add/sso-analytics ( 683a91...e67d7d )
by
unknown
162:06 queued 152:34
created

Jetpack_Sync_Deflate_Codec::decode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
require_once dirname( __FILE__ ) . '/interface.jetpack-sync-codec.php';
4
5
/**
6
 * An implementation of iJetpack_Sync_Codec that uses gzip's DEFLATE
7
 * algorithm to compress objects serialized using PHP's default
8
 * serializer
9
 */
10
class Jetpack_Sync_Deflate_Codec implements iJetpack_Sync_Codec {
11
	public function encode( $object ) {
12
		return base64_encode( gzdeflate( serialize( $object ) ) );
13
	}
14
15
	public function decode( $input ) {
16
		return unserialize( gzinflate( base64_decode( $input ) ) );
17
	}
18
}