Documentation

functions.php

Table of Contents

constantly()  : callable
Returns a function that always returns the same value;
filter()  : Generator
Filters values that do not satisfy the predicate function $pred.
map()  : Generator
Applies a map function $f to each value in a collection.
flatmap()  : Generator
Creates a generator that iterates over a sequence, then iterates over each value in the sequence and yields the application of the map function to each value.
partition()  : Generator
Partitions the input sequence into partitions of the specified size.
or_chain()  : callable
Returns a function that invokes the provided variadic functions one after the other until one of the functions returns a non-null value.
load_compiled_json()  : mixed
Loads a compiled JSON file from a PHP file.
clear_compiled_json()  : mixed
No-op
dir_iterator()  : Generator
Iterates over the files in a directory and works with custom wrappers.
recursive_dir_iterator()  : Generator
Returns a recursive directory iterator that yields absolute filenames.
describe_type()  : string
Debug function used to describe the provided value type and class.
default_http_handler()  : callable
Creates a default HTTP handler based on the available clients.
default_user_agent()  : string
Gets the default user agent string depending on the Guzzle version
serialize()  : RequestInterface
Serialize a request for a command but do not send it.
manifest()  : array<string|int, mixed>
Retrieves data for a service from the SDK's service manifest file.
is_valid_hostname()  : bool
Checks if supplied parameter is a valid hostname
is_valid_hostlabel()  : bool
Checks if supplied parameter is a valid host label
parse_ini_file()  : array<string|int, mixed>|bool
Ignores '#' full line comments, which parse_ini_file no longer does in PHP 7+.
boolean_value()  : bool|null
Outputs boolean value of input for a select range of possible values, null otherwise
is_valid_epoch()  : bool
Checks if an input is a valid epoch time

Functions

constantly()

Returns a function that always returns the same value;

constantly(mixed $value) : callable
Parameters
$value : mixed

Value to return.

Return values
callable

filter()

Filters values that do not satisfy the predicate function $pred.

filter(mixed $iterable, callable $pred) : Generator
Parameters
$iterable : mixed

Iterable sequence of data.

$pred : callable

Function that accepts a value and returns true/false

Return values
Generator

map()

Applies a map function $f to each value in a collection.

map(mixed $iterable, callable $f) : Generator
Parameters
$iterable : mixed

Iterable sequence of data.

$f : callable

Map function to apply.

Return values
Generator

flatmap()

Creates a generator that iterates over a sequence, then iterates over each value in the sequence and yields the application of the map function to each value.

flatmap(mixed $iterable, callable $f) : Generator
Parameters
$iterable : mixed

Iterable sequence of data.

$f : callable

Map function to apply.

Return values
Generator

partition()

Partitions the input sequence into partitions of the specified size.

partition(mixed $iterable, int $size) : Generator
Parameters
$iterable : mixed

Iterable sequence of data.

$size : int

Size to make each partition (except possibly the last chunk)

Return values
Generator

or_chain()

Returns a function that invokes the provided variadic functions one after the other until one of the functions returns a non-null value.

or_chain() : callable

The return function will call each passed function with any arguments it is provided.

$a = function ($x, $y) { return null; };
$b = function ($x, $y) { return $x + $y; };
$fn = \Aws\or_chain($a, $b);
echo $fn(1, 2); // 3
Return values
callable

load_compiled_json()

Loads a compiled JSON file from a PHP file.

load_compiled_json(string $path) : mixed

If the JSON file has not been cached to disk as a PHP file, it will be loaded from the JSON source file and returned.

Parameters
$path : string

Path to the JSON file on disk

Return values
mixed

Returns the JSON decoded data. Note that JSON objects are decoded as associative arrays.

clear_compiled_json()

No-op

clear_compiled_json() : mixed
Return values
mixed

dir_iterator()

Iterates over the files in a directory and works with custom wrappers.

dir_iterator(string $path[, resource $context = null ]) : Generator
Parameters
$path : string

Path to open (e.g., "s3://foo/bar").

$context : resource = null

Stream wrapper context.

Return values
Generator

Yields relative filename strings.

recursive_dir_iterator()

Returns a recursive directory iterator that yields absolute filenames.

recursive_dir_iterator(string $path[, resource $context = null ]) : Generator

This iterator is not broken like PHP's built-in DirectoryIterator (which will read the first file from a stream wrapper, then rewind, then read it again).

Parameters
$path : string

Path to traverse (e.g., s3://bucket/key, /tmp)

$context : resource = null

Stream context options.

Return values
Generator

Yields absolute filenames.

describe_type()

Debug function used to describe the provided value type and class.

describe_type(mixed $input) : string
Parameters
$input : mixed
Return values
string

Returns a string containing the type of the variable and if a class is provided, the class name.

default_http_handler()

Creates a default HTTP handler based on the available clients.

default_http_handler() : callable
Return values
callable

default_user_agent()

Gets the default user agent string depending on the Guzzle version

default_user_agent() : string
Return values
string

manifest()

Retrieves data for a service from the SDK's service manifest file.

manifest([string $service = null ]) : array<string|int, mixed>

Manifest data is stored statically, so it does not need to be loaded more than once per process. The JSON data is also cached in opcache.

Parameters
$service : string = null

Case-insensitive namespace or endpoint prefix of the service for which you are retrieving manifest data.

Tags
throws
InvalidArgumentException

if the service is not supported.

Return values
array<string|int, mixed>

is_valid_hostname()

Checks if supplied parameter is a valid hostname

is_valid_hostname(string $hostname) : bool
Parameters
$hostname : string
Return values
bool

is_valid_hostlabel()

Checks if supplied parameter is a valid host label

is_valid_hostlabel( $label) : bool
Parameters
$label :
Return values
bool

parse_ini_file()

Ignores '#' full line comments, which parse_ini_file no longer does in PHP 7+.

parse_ini_file( $filename[, bool $process_sections = false ][, int $scanner_mode = INI_SCANNER_NORMAL ]) : array<string|int, mixed>|bool
Parameters
$filename :
$process_sections : bool = false
$scanner_mode : int = INI_SCANNER_NORMAL
Return values
array<string|int, mixed>|bool

boolean_value()

Outputs boolean value of input for a select range of possible values, null otherwise

boolean_value( $input) : bool|null
Parameters
$input :
Return values
bool|null

is_valid_epoch()

Checks if an input is a valid epoch time

is_valid_epoch( $input) : bool
Parameters
$input :
Return values
bool

Search results