Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php

    r46586 r47122  
    6969                foreach ( $search_handlers as $search_handler ) {
    7070                        if ( ! $search_handler instanceof WP_REST_Search_Handler ) {
    71 
    72                                 /* translators: %s: PHP class name. */
    73                                 _doing_it_wrong( __METHOD__, sprintf( __( 'REST search handlers must extend the %s class.' ), 'WP_REST_Search_Handler' ), '5.0.0' );
     71                                _doing_it_wrong(
     72                                        __METHOD__,
     73                                        /* translators: %s: PHP class name. */
     74                                        sprintf( __( 'REST search handlers must extend the %s class.' ), 'WP_REST_Search_Handler' ),
     75                                        '5.0.0'
     76                                );
    7477                                continue;
    7578                        }
    … …  
    131134
    132135                if ( ! isset( $result[ WP_REST_Search_Handler::RESULT_IDS ] ) || ! is_array( $result[ WP_REST_Search_Handler::RESULT_IDS ] ) || ! isset( $result[ WP_REST_Search_Handler::RESULT_TOTAL ] ) ) {
    133                         return new WP_Error( 'rest_search_handler_error', __( 'Internal search handler error.' ), array( 'status' => 500 ) );
     136                        return new WP_Error(
     137                                'rest_search_handler_error',
     138                                __( 'Internal search handler error.' ),
     139                                array( 'status' => 500 )
     140                        );
    134141                }
    135142
    … …  
    137144
    138145                $results = array();
     146
    139147                foreach ( $ids as $id ) {
    140148                        $data      = $this->prepare_item_for_response( $id, $request );
    … …  
    148156
    149157                if ( $page > $max_pages && $total > 0 ) {
    150                         return new WP_Error( 'rest_search_invalid_page_number', __( 'The page number requested is larger than the number of pages available.' ), array( 'status' => 400 ) );
     158                        return new WP_Error(
     159                                'rest_search_invalid_page_number',
     160                                __( 'The page number requested is larger than the number of pages available.' ),
     161                                array( 'status' => 400 )
     162                        );
    151163                }
    152164
    … …  
    218230                $types    = array();
    219231                $subtypes = array();
     232
    220233                foreach ( $this->search_handlers as $search_handler ) {
    221234                        $types[]  = $search_handler->get_type();
    … …  
    268281
    269282                $this->schema = $schema;
     283
    270284                return $this->add_additional_fields_schema( $this->schema );
    271285        }
    … …  
    281295                $types    = array();
    282296                $subtypes = array();
     297
    283298                foreach ( $this->search_handlers as $search_handler ) {
    284299                        $types[]  = $search_handler->get_type();
    … …  
    357372
    358373                if ( ! $type || ! isset( $this->search_handlers[ $type ] ) ) {
    359                         return new WP_Error( 'rest_search_invalid_type', __( 'Invalid type parameter.' ), array( 'status' => 400 ) );
     374                        return new WP_Error(
     375                                'rest_search_invalid_type',
     376                                __( 'Invalid type parameter.' ),
     377                                array( 'status' => 400 )
     378                        );
    360379                }
    361380
Note: See TracChangeset for help on using the changeset viewer.