Skip to content

Commit f0867a9

Browse files
committed
remove unneeded code
1 parent 808b73f commit f0867a9

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

includes/rest/class-collection.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public static function register_routes() {
4848
array(
4949
'methods' => WP_REST_Server::READABLE,
5050
'callback' => array( self::class, 'tags_get' ),
51-
'args' => self::request_parameters(),
5251
'permission_callback' => '__return_true',
5352
),
5453
)
@@ -61,7 +60,6 @@ public static function register_routes() {
6160
array(
6261
'methods' => WP_REST_Server::READABLE,
6362
'callback' => array( self::class, 'featured_get' ),
64-
'args' => self::request_parameters(),
6563
'permission_callback' => '__return_true',
6664
),
6765
)
@@ -102,15 +100,16 @@ public static function register_routes() {
102100
*/
103101
public static function replies_get( $request ) {
104102
$type = $request->get_param( 'type' );
103+
$id = (int) $request->get_param( 'id' );
105104

106105
// Get the WordPress object of that "owns" the requested replies.
107106
switch ( $type ) {
108107
case 'comment':
109-
$wp_object = \get_comment( $request->get_param( 'id' ) );
108+
$wp_object = \get_comment( $id );
110109
break;
111110
case 'post':
112111
default:
113-
$wp_object = \get_post( $request->get_param( 'id' ) );
112+
$wp_object = \get_post( $id );
114113
break;
115114
}
116115

@@ -125,7 +124,7 @@ public static function replies_get( $request ) {
125124
);
126125
}
127126

128-
$page = intval( $request->get_param( 'page' ) );
127+
$page = (int) $request->get_param( 'page' );
129128

130129
// If the request parameter page is present get the CollectionPage otherwise the replies collection.
131130
if ( isset( $page ) ) {
@@ -284,17 +283,6 @@ public static function moderators_get() {
284283
return $rest_response;
285284
}
286285

287-
/**
288-
* The supported parameters.
289-
*
290-
* @return array List of parameters.
291-
*/
292-
public static function request_parameters() {
293-
$params = array();
294-
295-
return $params;
296-
}
297-
298286
/**
299287
* The supported parameters.
300288
*

0 commit comments

Comments
 (0)