>, * total: int * }|WP_Error * @param WP_REST_Request> $request */ public function list_page( WP_REST_Request $request ): array|WP_Error { $query = $this->link_list_query_reader->read( $request ); if ( $query instanceof WP_Error ) { return $query; } $items = array(); foreach ( $this->link_list_repository->page_of( $query ) as $link ) { $items[] = $this->link_presenter->present( $link ); } return array( 'items' => $items, 'total' => $this->link_list_repository->count_matching( $query ), ); } }