Passed
Push — master ( 4d016b...b6e428 )
by Benjamin
02:33
created

API   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
dl 0
loc 17
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register_routes() 0 12 1
1
<?php
2
/**
3
 * Custom routes and endpoints for the plugin.
4
 *
5
 * @package WPSiteMonitor
6
 * @link https://github.com/BWibrew/WP-Site-Monitor/
7
 * @author Benjamin Wibrew <[email protected]>
8
 * @since 1.0.0
9
 */
10
11
namespace WPSiteMonitor;
12
13
use WP_REST_Controller;
14
use WP_REST_Server;
15
16
/**
17
 * Class API
18
 *
19
 * @package WPSiteMonitor
20
 */
21
class API extends WP_REST_Controller {
22
23
	/**
24
	 * Register the routes for the objects of the controller.
25
	 */
26 1
	public function register_routes() {
27 1
		$version   = '1';
28 1
		$namespace = 'wp-site-monitor/v' . $version;
29 1
		$base      = 'wp-version';
30
31 1
		register_rest_route(
32 1
			$namespace, '/' . $base, array(
33
				array(
34 1
					'methods'             => WP_REST_Server::READABLE,
35 1
					'callback'            => array( $this, 'get_wp_version' ),
36 1
					'permission_callback' => array( $this, 'check_permission' ),
37
					'args'                => array(),
38
				),
39
			)
40
		);
41 1
	}
42
}
43