Completed
Push — try/end-to-end-sync-v2 ( b48e5f...4fd642 )
by
unknown
86:44 queued 77:41
created

Jetpack_Sync_Deflate_Codec::decode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
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 )  );
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected ';', expecting ',' or ')'
Loading history...
17
	}
18
}