Completed
Push — master ( 8851bc...2533f0 )
by Jeremy
32:27 queued 21:03
created

VaultPress_CLI   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register_via_jetpack() 0 8 2
1
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
/**
3
 * WP CLI commands for vaultpress.
4
 *
5
 * @package automattic/vaultpress
6
 */
7
8
WP_CLI::add_command( 'vaultpress', 'VaultPress_CLI' );
9
10
/**
11
 * Filter spam comments.
12
 */
13
class VaultPress_CLI extends WP_CLI_Command {
14
	/**
15
	 * Automatically registers VaultPress via the Jetpack plugin (if already signed up).
16
	 *
17
	 * ## EXAMPLES
18
	 *
19
	 *     wp vaultpress register_via_jetpack
20
	 *
21
	 * @alias comment-check
22
	 */
23
	public function register_via_jetpack() {
24
		$result = VaultPress::init()->register_via_jetpack( true );
25
		if ( is_wp_error( $result ) ) {
26
			WP_CLI::error( 'Failed to register VaultPress: ' . $result->get_error_message() );
27
		} else {
28
			WP_CLI::line( 'Successfully registered VaultPress via Jetpack.' );
29
		}
30
	}
31
}
32