Completed
Push — add/plugin_name ( 40fc07 )
by
unknown
11:13
created

Jetpack_Sync_Module_Plugins   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A name() 0 3 1
A init_listeners() 0 5 1
A init_before_send() 0 5 1
A expand_plugin_data() 0 4 1
1
<?php
2
3
class Jetpack_Sync_Module_Plugins extends Jetpack_Sync_Module {
4
5
	public function name() {
6
		return 'plugins';
7
	}
8
9
	public function init_listeners( $callable ) {
10
		add_action( 'deleted_plugin', $callable, 10, 2 );
11
		add_action( 'activated_plugin', $callable, 10, 2 );
12
		add_action( 'deactivated_plugin', $callable, 10, 2 );
13
	}
14
15
	public function init_before_send() {
16
		add_filter( 'jetpack_sync_before_send_deleted_plugin', array( $this, 'expand_plugin_data' ) );
17
		add_filter( 'jetpack_sync_before_send_activated_plugin', array( $this, 'expand_plugin_data' ) );
18
		add_filter( 'jetpack_sync_before_send_deactivated_plugin', array( $this, 'expand_plugin_data' ) );
19
	}
20
21
	public function expand_plugin_data( $args ) {
22
		$plugin_data = get_plugin_data( $args[0] );
23
		return array( $args[0], $args[1], $plugin_data );
24
	}
25
}
26