Ticket #8620: 8620-http-php-api--method-improvements-docblocks-and-robustness.patch
File 8620-http-php-api--method-improvements-docblocks-and-robustness.patch, 1.7 KB (added by , 14 years ago) |
---|
-
wp-includes/http.php
1978 1978 * @return array The header value. Empty string on if incorrect parameter given. 1979 1979 */ 1980 1980 function wp_remote_retrieve_header(&$response, $header) { 1981 if ( ! isset($response['headers']) || ! is_array($response['headers'])) 1982 return ''; 1983 1984 if ( array_key_exists($header, $response['headers']) ) 1985 return $response['headers'][$header]; 1986 1987 return ''; 1981 return isset($response['headers'][$header]) ? $response['headers'][$header] : ''; 1988 1982 } 1989 1983 1990 1984 /** … … 1995 1989 * @since 2.7.0 1996 1990 * 1997 1991 * @param array $response HTTP response. 1998 * @return array The keys 'code' and 'message' give information on the response.1992 * @return string Response Code. Empty string on failure. 1999 1993 */ 2000 function wp_remote_retrieve_response_code(&$response) { 2001 if ( ! isset($response['response']) || ! is_array($response['response'])) 2002 return ''; 2003 2004 return $response['response']['code']; 1994 function wp_remote_retrieve_response_code(&$response) { 1995 return isset($response['response']['code']) ? $response['response']['code'] : ''; 2005 1996 } 2006 1997 2007 1998 /** … … 2012 2003 * @since 2.7.0 2013 2004 * 2014 2005 * @param array $response HTTP response. 2015 * @return array The keys 'code' and 'message' give information on the response.2006 * @return string Response Message. Empty string on failure. 2016 2007 */ 2017 2008 function wp_remote_retrieve_response_message(&$response) { 2018 if ( ! isset($response['response']) || ! is_array($response['response'])) 2019 return ''; 2020 2021 return $response['response']['message']; 2009 return isset($response['response']['message']) ? $response['response']['message'] : ''; 2022 2010 } 2023 2011 2024 2012 /**