Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 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-controller.php

    r46696 r47122  
    4545     */
    4646    public function register_routes() {
    47         /* translators: %s: register_routes() */
    48         _doing_it_wrong( 'WP_REST_Controller::register_routes', sprintf( __( "Method '%s' must be overridden." ), __METHOD__ ), '4.7' );
     47        _doing_it_wrong(
     48            'WP_REST_Controller::register_routes',
     49            /* translators: %s: register_routes() */
     50            sprintf( __( "Method '%s' must be overridden." ), __METHOD__ ),
     51            '4.7'
     52        );
    4953    }
    5054
     
    5862     */
    5963    public function get_items_permissions_check( $request ) {
    60         /* translators: %s: Method name. */
    61         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     64        return new WP_Error(
     65            'invalid-method',
     66            /* translators: %s: Method name. */
     67            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     68            array( 'status' => 405 )
     69        );
    6270    }
    6371
     
    7179     */
    7280    public function get_items( $request ) {
    73         /* translators: %s: Method name. */
    74         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     81        return new WP_Error(
     82            'invalid-method',
     83            /* translators: %s: Method name. */
     84            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     85            array( 'status' => 405 )
     86        );
    7587    }
    7688
     
    8496     */
    8597    public function get_item_permissions_check( $request ) {
    86         /* translators: %s: Method name. */
    87         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     98        return new WP_Error(
     99            'invalid-method',
     100            /* translators: %s: Method name. */
     101            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     102            array( 'status' => 405 )
     103        );
    88104    }
    89105
     
    97113     */
    98114    public function get_item( $request ) {
    99         /* translators: %s: Method name. */
    100         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     115        return new WP_Error(
     116            'invalid-method',
     117            /* translators: %s: Method name. */
     118            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     119            array( 'status' => 405 )
     120        );
    101121    }
    102122
     
    110130     */
    111131    public function create_item_permissions_check( $request ) {
    112         /* translators: %s: Method name. */
    113         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     132        return new WP_Error(
     133            'invalid-method',
     134            /* translators: %s: Method name. */
     135            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     136            array( 'status' => 405 )
     137        );
    114138    }
    115139
     
    123147     */
    124148    public function create_item( $request ) {
    125         /* translators: %s: Method name. */
    126         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     149        return new WP_Error(
     150            'invalid-method',
     151            /* translators: %s: Method name. */
     152            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     153            array( 'status' => 405 )
     154        );
    127155    }
    128156
     
    136164     */
    137165    public function update_item_permissions_check( $request ) {
    138         /* translators: %s: Method name. */
    139         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     166        return new WP_Error(
     167            'invalid-method',
     168            /* translators: %s: Method name. */
     169            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     170            array( 'status' => 405 )
     171        );
    140172    }
    141173
     
    149181     */
    150182    public function update_item( $request ) {
    151         /* translators: %s: Method name. */
    152         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     183        return new WP_Error(
     184            'invalid-method',
     185            /* translators: %s: Method name. */
     186            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     187            array( 'status' => 405 )
     188        );
    153189    }
    154190
     
    162198     */
    163199    public function delete_item_permissions_check( $request ) {
    164         /* translators: %s: Method name. */
    165         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     200        return new WP_Error(
     201            'invalid-method',
     202            /* translators: %s: Method name. */
     203            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     204            array( 'status' => 405 )
     205        );
    166206    }
    167207
     
    175215     */
    176216    public function delete_item( $request ) {
    177         /* translators: %s: Method name. */
    178         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     217        return new WP_Error(
     218            'invalid-method',
     219            /* translators: %s: Method name. */
     220            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     221            array( 'status' => 405 )
     222        );
    179223    }
    180224
     
    188232     */
    189233    protected function prepare_item_for_database( $request ) {
    190         /* translators: %s: Method name. */
    191         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     234        return new WP_Error(
     235            'invalid-method',
     236            /* translators: %s: Method name. */
     237            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     238            array( 'status' => 405 )
     239        );
    192240    }
    193241
     
    202250     */
    203251    public function prepare_item_for_response( $item, $request ) {
    204         /* translators: %s: Method name. */
    205         return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) );
     252        return new WP_Error(
     253            'invalid-method',
     254            /* translators: %s: Method name. */
     255            sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ),
     256            array( 'status' => 405 )
     257        );
    206258    }
    207259
     
    392444
    393445        foreach ( $additional_fields as $field_name => $field_options ) {
    394 
    395446            if ( ! $field_options['get_callback'] ) {
    396447                continue;
     
    530581
    531582        $additional_fields = $this->get_additional_fields();
     583
    532584        foreach ( $additional_fields as $field_name => $field_options ) {
    533585            // For back-compat, include any field with an empty schema
     
    573625                // Check for nested fields if $field is not a direct match.
    574626                $nested_fields = explode( '.', $field );
    575                 // A nested field is included so long as its top-level property is
    576                 // present in the schema.
     627                // A nested field is included so long as its top-level property
     628                // is present in the schema.
    577629                if ( in_array( $nested_fields[0], $fields, true ) ) {
    578630                    $response_fields[] = $field;
Note: See TracChangeset for help on using the changeset viewer.