class Utils

Methods

jsonDecode (ResponseInterface $response, bool $assoc = true) static 

No description

flattenJson (array $data, string $key = null) : static array

Method for flattening a nested array.

normalizeUrl (string $url) : static string

Method for normalize an URL string.

addPaths (UriInterface $uri, ...$paths $paths) : static UriInterface

Add an unlimited list of paths to a given URI.

appendPath (UriInterface $uri, $path) static 

No description

Details

static jsonDecode(ResponseInterface $response, bool $assoc = true)

Parameters

$response ResponseInterface
$assoc bool

Example code

$utils->jsonDecode($response, $assoc);

static flattenJson(array $data, string $key = null)

Method for flattening a nested array.

Parameters

$data array The nested array
$key string The key to extract

Return value

array

Example code

$array = $utils->flattenJson($data, $key);

static normalizeUrl(string $url)

Method for normalize an URL string.

Append the http:// prefix if not present, and add a closing url separator when missing.

Parameters

$url string The url representation.

Return value

string

Example code

$string = $utils->normalizeUrl($url);

static addPaths(UriInterface $uri, ...$paths $paths)

Add an unlimited list of paths to a given URI.

Parameters

$uri UriInterface
$paths ...$paths

Return value

UriInterface

Example code

$uriInterface = $utils->addPaths($uri, $paths);

static appendPath(UriInterface $uri, $path)

Parameters

$uri UriInterface
$path

Example code

$utils->appendPath($uri, $path);