Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r42000 r42343  
    3636    public function register_routes() {
    3737
    38         register_rest_route( $this->namespace, '/' . $this->rest_base, array(
    39             array(
    40                 'methods'             => WP_REST_Server::READABLE,
    41                 'callback'            => array( $this, 'get_item' ),
    42                 'args'                => array(),
    43                 'permission_callback' => array( $this, 'get_item_permissions_check' ),
    44             ),
    45             array(
    46                 'methods'             => WP_REST_Server::EDITABLE,
    47                 'callback'            => array( $this, 'update_item' ),
    48                 'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
    49                 'permission_callback' => array( $this, 'get_item_permissions_check' ),
    50             ),
    51             'schema' => array( $this, 'get_public_item_schema' ),
    52         ) );
     38        register_rest_route(
     39            $this->namespace, '/' . $this->rest_base, array(
     40                array(
     41                    'methods'             => WP_REST_Server::READABLE,
     42                    'callback'            => array( $this, 'get_item' ),
     43                    'args'                => array(),
     44                    'permission_callback' => array( $this, 'get_item_permissions_check' ),
     45                ),
     46                array(
     47                    'methods'             => WP_REST_Server::EDITABLE,
     48                    'callback'            => array( $this, 'update_item' ),
     49                    'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
     50                    'permission_callback' => array( $this, 'get_item_permissions_check' ),
     51                ),
     52                'schema' => array( $this, 'get_public_item_schema' ),
     53            )
     54        );
    5355
    5456    }
     
    140142        $options = $this->get_registered_options();
    141143
    142         $params  = $request->get_params();
     144        $params = $request->get_params();
    143145
    144146        foreach ( $options as $name => $args ) {
     
    233235            );
    234236
    235             $rest_args['schema'] = array_merge( $default_schema, $rest_args['schema'] );
     237            $rest_args['schema']      = array_merge( $default_schema, $rest_args['schema'] );
    236238            $rest_args['option_name'] = $name;
    237239
     
    275277
    276278        foreach ( $options as $option_name => $option ) {
    277             $schema['properties'][ $option_name ] = $option['schema'];
     279            $schema['properties'][ $option_name ]                = $option['schema'];
    278280            $schema['properties'][ $option_name ]['arg_options'] = array(
    279281                'sanitize_callback' => array( $this, 'sanitize_callback' ),
Note: See TracChangeset for help on using the changeset viewer.