Completed
Push — fix/normalize-www-in-site-url-... ( e67e76 )
by
unknown
13:13 queued 02:59
created

WPCOM_JSON_API_Get_Comment_Endpoint::callback()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 18
Code Lines 10

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
cc 4
eloc 10
nc 3
nop 3
dl 18
loc 18
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
class WPCOM_JSON_API_Get_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endpoint {
4
	// /sites/%s/comments/%d -> $blog_id, $comment_id
5 View Code Duplication
	function callback( $path = '', $blog_id = 0, $comment_id = 0 ) {
6
		$blog_id = $this->api->switch_to_blog_and_validate_user( $this->api->get_blog_id( $blog_id ) );
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $blog_id. This often makes code more readable.
Loading history...
7
		if ( is_wp_error( $blog_id ) ) {
8
			return $blog_id;
9
		}
10
11
		$args = $this->query_args();
12
13
		$return = $this->get_comment( $comment_id, $args['context'] );
14
		if ( !$return || is_wp_error( $return ) ) {
15
			return $return;
16
		}
17
18
		/** This action is documented in json-endpoints/class.wpcom-json-api-site-settings-endpoint.php */
19
		do_action( 'wpcom_json_api_objects', 'comments' );
20
21
		return $return;
22
	}
23
}
24