PHP Class VCR\Util\HttpUtil

Afficher le fichier Open project: php-vcr/php-vcr Class Usage Examples

Méthodes publiques

Méthode Description
formatAsStatusString ( Response $response ) : string Returns a HTTP status line from specified response.
formatAsStatusWithHeadersString ( Response $response ) : string Returns a HTTP status line with headers from specified response.
formatHeadersForCurl ( array $headers ) : array Returns a list of headers from a key/value paired array.
parseHeaders ( array $headers ) : array Returns key value pairs of response headers.
parseRawHeader ( $rawHeader ) : array Returns an array of arrays for specified raw header string.
parseResponse ( string $response ) : array Returns status, headers and body from a HTTP response string.
parseStatus ( string $status ) : array Returns http_version, code and message from a HTTP status line.

Method Details

formatAsStatusString() public static méthode

Returns a HTTP status line from specified response.
public static formatAsStatusString ( Response $response ) : string
$response VCR\Response
Résultat string HTTP status line.

formatAsStatusWithHeadersString() public static méthode

Returns a HTTP status line with headers from specified response.
public static formatAsStatusWithHeadersString ( Response $response ) : string
$response VCR\Response
Résultat string HTTP status line.

formatHeadersForCurl() public static méthode

Returns a list of headers from a key/value paired array.
public static formatHeadersForCurl ( array $headers ) : array
$headers array Headers as key/value pairs.
Résultat array List of headers ['Content-Type: text/html', '...'].

parseHeaders() public static méthode

Returns key value pairs of response headers.
public static parseHeaders ( array $headers ) : array
$headers array List of headers. Example: ['Content-Type: text/html', '...']
Résultat array Key/value pairs of headers, e.g. ['Content-Type' => 'text/html']

parseRawHeader() public static méthode

Returns an array of arrays for specified raw header string.
public static parseRawHeader ( $rawHeader ) : array
Résultat array

parseResponse() public static méthode

Returns status, headers and body from a HTTP response string.
public static parseResponse ( string $response ) : array
$response string Response including header and body.
Résultat array Status, headers and body as strings.

parseStatus() public static méthode

Returns http_version, code and message from a HTTP status line.
public static parseStatus ( string $status ) : array
$status string HTTP status line, e.g. HTTP/1.1 200 OK
Résultat array Parsed 'http_version', 'code' and 'message'.