Code Duplication    Length = 19-21 lines in 2 locations

json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php 1 location

@@ 28-48 (lines=21) @@
25
		return parent::callback( $path, $blog_id, $object );
26
	}
27
28
	public function default_action() {
29
		$args = $this->input();
30
31
		if ( isset( $args['autoupdate'] ) && is_bool( $args['autoupdate'] ) ) {
32
			if ( $args['autoupdate'] ) {
33
				$this->autoupdate_on();
34
			} else {
35
				$this->autoupdate_off();
36
			}
37
		}
38
39
		if ( isset( $args['active'] ) && is_bool( $args['active'] ) ) {
40
			if ( $args['active'] ) {
41
				return $this->activate();
42
			} else {
43
				return $this->deactivate();
44
			}
45
		}
46
47
		return true;
48
	}
49
50
	protected function autoupdate_on() {
51
		$autoupdate_plugins = Jetpack_Options::get_option( 'autoupdate_plugins', array() );

json-endpoints/jetpack/class.jetpack-json-api-themes-modify-endpoint.php 1 location

@@ 11-29 (lines=19) @@
8
	protected $action              = 'default_action';
9
	protected $expected_actions    = array( 'update', 'update_translations' );
10
11
	public function default_action() {
12
		$args = $this->input();
13
		if ( isset( $args['autoupdate'] ) && is_bool( $args['autoupdate'] ) ) {
14
			if ( $args['autoupdate'] ) {
15
				$this->autoupdate_on();
16
			} else {
17
				$this->autoupdate_off();
18
			}
19
		}
20
		if ( isset( $args['autoupdate_themes_translations'] ) && is_bool( $args['autoupdate_themes_translations'] ) ) {
21
			if ( $args['autoupdate_themes_translations'] ) {
22
				$this->autoupdate_translations_on();
23
			} else {
24
				$this->autoupdate_translations_off();
25
			}
26
		}
27
28
		return true;
29
	}
30
31
	function autoupdate_on() {
32
		$autoupdate_themes = Jetpack_Options::get_option( 'autoupdate_themes', array() );