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

Jetpack_Sync_Deflate_Codec   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 9
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 )  );
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
}