VuFind API Documentation

PrintArrayHtml extends AbstractHelper
in package

View helper to print an array formatted for HTML display.

Tags
category

VuFind

author

Nathan Collins colli372@msu.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

__invoke()  : string
Print an array formatted for HTML display.
isArrayFlat()  : bool
Check if variable is an array and has no arrays as values.
isArrayList()  : bool
Check is a variable is and array and all keys are sequential integers starting from index 0.
isSingleKeyList()  : bool
Check if variable is an integer keyed array of size 1 whose single value is not an array.

Methods

__invoke()

Print an array formatted for HTML display.

public __invoke(array<string|int, mixed>|string $entry, int $indentLevel[, bool $indentFirst = true ]) : string

Function uses recursion to achieve desired results, so entry can be either an array or a value to display.

Parameters
$entry : array<string|int, mixed>|string

An array or string to output

$indentLevel : int

How many spaces to indent output

$indentFirst : bool = true

Should first item in array be indented

Return values
string

The formatted HTML for output

isArrayFlat()

Check if variable is an array and has no arrays as values.

protected isArrayFlat(mixed $var) : bool
Parameters
$var : mixed

A variable to perform the check on.

Return values
bool

isArrayList()

Check is a variable is and array and all keys are sequential integers starting from index 0.

protected isArrayList(mixed $var) : bool

TODO This function can be replaced by array_is_list() in PHP8

Parameters
$var : mixed

A variable to perform the check on.

Return values
bool

isSingleKeyList()

Check if variable is an integer keyed array of size 1 whose single value is not an array.

protected isSingleKeyList(mixed $var) : bool
Parameters
$var : mixed

A variable to perform the check on.

Return values
bool

Search results