[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/guzzlehttp/psr7/src/ -> functions.php (summary)

(no description)

File Size: 422 lines (13 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 22 functions

  str()
  uri_for()
  stream_for()
  parse_header()
  normalize_header()
  modify_request()
  rewind_body()
  try_fopen()
  copy_to_string()
  copy_to_stream()
  hash()
  readline()
  parse_request()
  parse_response()
  parse_query()
  build_query()
  mimetype_from_filename()
  mimetype_from_extension()
  _parse_message()
  _parse_request_uri()
  get_message_body_summary()
  _caseless_remove()

Functions
Functions that are not part of a class:

str(MessageInterface $message)   X-Ref
Returns the string representation of an HTTP message.

param: MessageInterface $message Message to convert to a string.
return: string

uri_for($uri)   X-Ref
Returns a UriInterface for the given value.

This function accepts a string or UriInterface and returns a
UriInterface for the given value. If the value is already a
UriInterface, it is returned as-is.

param: string|UriInterface $uri
return: UriInterface

stream_for($resource = '', array $options = [])   X-Ref
Create a new stream based on the input type.

Options is an associative array that can contain the following keys:
- metadata: Array of custom metadata.
- size: Size of the stream.

This method accepts the following `$resource` types:
- `Psr\Http\Message\StreamInterface`: Returns the value as-is.
- `string`: Creates a stream object that uses the given string as the contents.
- `resource`: Creates a stream object that wraps the given PHP stream resource.
- `Iterator`: If the provided value implements `Iterator`, then a read-only
stream object will be created that wraps the given iterable. Each time the
stream is read from, data from the iterator will fill a buffer and will be
continuously called until the buffer is equal to the requested read size.
Subsequent read calls will first read from the buffer and then call `next`
on the underlying iterator until it is exhausted.
- `object` with `__toString()`: If the object has the `__toString()` method,
the object will be cast to a string and then a stream will be returned that
uses the string value.
- `NULL`: When `null` is passed, an empty stream object is returned.
- `callable` When a callable is passed, a read-only stream object will be
created that invokes the given callable. The callable is invoked with the
number of suggested bytes to read. The callable can return any number of
bytes, but MUST return `false` when there is no more data to return. The
stream object that wraps the callable will invoke the callable until the
number of requested bytes are available. Any additional bytes will be
buffered and used in subsequent reads.

param: resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data
param: array                                                                  $options  Additional options
return: StreamInterface

parse_header($header)   X-Ref
Parse an array of header values containing ";" separated data into an
array of associative arrays representing the header key value pair data
of the header. When a parameter does not contain a value, but just
contains a key, this function will inject a key with a '' string value.

param: string|array $header Header to parse into components.
return: array Returns the parsed header values.

normalize_header($header)   X-Ref
Converts an array of header values that may contain comma separated
headers into an array of headers with no comma separated values.

param: string|array $header Header to normalize.
return: array Returns the normalized header field values.

modify_request(RequestInterface $request, array $changes)   X-Ref
Clone and modify a request with the given changes.

This method is useful for reducing the number of clones needed to mutate a
message.

The changes can be one of:
- method: (string) Changes the HTTP method.
- set_headers: (array) Sets the given headers.
- remove_headers: (array) Remove the given headers.
- body: (mixed) Sets the given body.
- uri: (UriInterface) Set the URI.
- query: (string) Set the query string value of the URI.
- version: (string) Set the protocol version.

param: RequestInterface $request Request to clone and modify.
param: array            $changes Changes to apply.
return: RequestInterface

rewind_body(MessageInterface $message)   X-Ref
Attempts to rewind a message body and throws an exception on failure.

The body of the message will only be rewound if a call to `tell()` returns a
value other than `0`.

param: MessageInterface $message Message to rewind

try_fopen($filename, $mode)   X-Ref
Safely opens a PHP stream resource using a filename.

When fopen fails, PHP normally raises a warning. This function adds an
error handler that checks for errors and throws an exception instead.

param: string $filename File to open
param: string $mode     Mode used to open the file
return: resource

copy_to_string(StreamInterface $stream, $maxLen = -1)   X-Ref
Copy the contents of a stream into a string until the given number of
bytes have been read.

param: StreamInterface $stream Stream to read
param: int             $maxLen Maximum number of bytes to read. Pass -1
return: string

copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)   X-Ref
Copy the contents of a stream into another stream until the given number
of bytes have been read.

param: StreamInterface $source Stream to read from
param: StreamInterface $dest   Stream to write to
param: int             $maxLen Maximum number of bytes to read. Pass -1

hash(StreamInterface $stream, $algo, $rawOutput = false)   X-Ref
Calculate a hash of a stream.

This method reads the entire stream to calculate a rolling hash, based on
PHP's `hash_init` functions.

param: StreamInterface $stream    Stream to calculate the hash for
param: string          $algo      Hash algorithm (e.g. md5, crc32, etc)
param: bool            $rawOutput Whether or not to use raw output
return: string Returns the hash of the stream

readline(StreamInterface $stream, $maxLength = null)   X-Ref
Read a line from the stream up to the maximum allowed buffer length.

param: StreamInterface $stream    Stream to read from
param: int|null        $maxLength Maximum buffer length
return: string

parse_request($message)   X-Ref
Parses a request message string into a request object.

param: string $message Request message string.
return: Request

parse_response($message)   X-Ref
Parses a response message string into a response object.

param: string $message Response message string.
return: Response

parse_query($str, $urlEncoding = true)   X-Ref
Parse a query string into an associative array.

If multiple values are found for the same key, the value of that key value
pair will become an array. This function does not parse nested PHP style
arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed
into `['foo[a]' => '1', 'foo[b]' => '2'])`.

param: string   $str         Query string to parse
param: int|bool $urlEncoding How the query string is encoded
return: array

build_query(array $params, $encoding = PHP_QUERY_RFC3986)   X-Ref
Build a query string from an array of key value pairs.

This function can use the return value of `parse_query()` to build a query
string. This function does not modify the provided keys when an array is
encountered (like `http_build_query()` would).

param: array     $params   Query string parameters.
param: int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
return: string

mimetype_from_filename($filename)   X-Ref
Determines the mimetype of a file by looking at its extension.

param: string $filename
return: string|null

mimetype_from_extension($extension)   X-Ref
Maps a file extensions to a mimetype.

param: $extension string The file extension.
return: string|null

_parse_message($message)   X-Ref
Parses an HTTP message into an associative array.

The array contains the "start-line" key containing the start line of
the message, "headers" key containing an associative array of header
array values, and a "body" key containing the body of the message.

param: string $message HTTP request or response to parse.
return: array

_parse_request_uri($path, array $headers)   X-Ref
Constructs a URI for an HTTP request message.

param: string $path    Path from the start-line
param: array  $headers Array of headers (each value an array).
return: string

get_message_body_summary(MessageInterface $message, $truncateAt = 120)   X-Ref
Get a short summary of the message body.

Will return `null` if the response is not printable.

param: MessageInterface $message    The message to get the body summary
param: int              $truncateAt The maximum allowed size of the summary
return: string|null

_caseless_remove($keys, array $data)   X-Ref
Remove the items given by the keys, case insensitively from the data.

param: iterable<string> $keys
return: array



Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1