Make WordPress Core

Changeset 52964


Ignore:
Timestamp:
03/20/2022 04:01:01 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename the $strResponse variable to $response in WP_Http_Streams::request().

This fixes a Variable "$strResponse" is not in valid snake_case format WPCS warning.

For consistency, this commit also renames the WP_Http::processResponse() argument to $response.

Follow-up to [8516], [51825], [51929], [51940], [52025], [52960], [52961], [52962], [52963].

Props azouamauriac.
See #54728.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-http-streams.php

    r52963 r52964  
    264264        }
    265265
    266         $strResponse  = '';
     266        $response     = '';
    267267        $body_started = false;
    268268        $keep_reading = true;
     
    298298                $block = fread( $handle, $block_size );
    299299                if ( ! $body_started ) {
    300                     $strResponse .= $block;
    301                     if ( strpos( $strResponse, "\r\n\r\n" ) ) {
    302                         $processed_response = WP_Http::processResponse( $strResponse );
     300                    $response .= $block;
     301                    if ( strpos( $response, "\r\n\r\n" ) ) {
     302                        $processed_response = WP_Http::processResponse( $response );
    303303                        $body_started       = true;
    304304                        $block              = $processed_response['body'];
    305                         unset( $strResponse );
     305                        unset( $response );
    306306                        $processed_response['body'] = '';
    307307                    }
     
    339339
    340340            while ( ! feof( $handle ) && $keep_reading ) {
    341                 $block        = fread( $handle, $block_size );
    342                 $strResponse .= $block;
    343 
    344                 if ( ! $body_started && strpos( $strResponse, "\r\n\r\n" ) ) {
    345                     $header_length = strpos( $strResponse, "\r\n\r\n" ) + 4;
     341                $block     = fread( $handle, $block_size );
     342                $response .= $block;
     343
     344                if ( ! $body_started && strpos( $response, "\r\n\r\n" ) ) {
     345                    $header_length = strpos( $response, "\r\n\r\n" ) + 4;
    346346                    $body_started  = true;
    347347                }
     
    350350                    ! $body_started
    351351                    || ! isset( $parsed_args['limit_response_size'] )
    352                     || strlen( $strResponse ) < ( $header_length + $parsed_args['limit_response_size'] )
    353                 );
    354             }
    355 
    356             $processed_response = WP_Http::processResponse( $strResponse );
    357             unset( $strResponse );
     352                    || strlen( $response ) < ( $header_length + $parsed_args['limit_response_size'] )
     353                );
     354            }
     355
     356            $processed_response = WP_Http::processResponse( $response );
     357            unset( $response );
    358358
    359359        }
  • trunk/src/wp-includes/class-wp-http.php

    r52597 r52964  
    656656     * @since 2.7.0
    657657     *
    658      * @param string $str_response The full response string.
     658     * @param string $response The full response string.
    659659     * @return array {
    660660     *     Array with response headers and body.
     
    664664     * }
    665665     */
    666     public static function processResponse( $str_response ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
    667         $response = explode( "\r\n\r\n", $str_response, 2 );
     666    public static function processResponse( $response ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
     667        $response = explode( "\r\n\r\n", $response, 2 );
    668668
    669669        return array(
Note: See TracChangeset for help on using the changeset viewer.