Class Tools (namespace Nette)


Tools library.


Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Tools.php (line 30)
Public Method Summary
Tools
Static class - cannot be instantiated.
static mixed
arrayGet ($arr, scalar $key, [mixed $default = NULL])
Returns array item or $default if item is not set.
static array
arrayMergeTree (array $arr1, array $arr2)
Recursively appends elements of remaining keys from the second array to the first.
static bool
catchError (string &$message)
Returns catched error/warning message.
static void
defaultize (mixed &$var, mixed $default)
Initializes variable with $default value.
static array
glob (string $pattern, [int $flags = 0])
Recursive glob(). Finds pathnames matching a pattern.
static bool
iniFlag (string $var)
Gets the boolean value of a configuration option.
static void
tryError ([$level = E_ALL])
Starts catching potential errors/warnings.
Constant Summary
int DAY 86400

line 36

day in seconds
int HOUR 3600

line 33

hour in seconds
int YEAR 31557600

line 39

year in seconds

Method Details

line 46

__construct

public Tools __construct ()

Static class - cannot be instantiated.

Output
Tools  

line 89

arrayGet

public static mixed arrayGet ($arr, scalar $key, [mixed $default = NULL])

Returns array item or $default if item is not set.

Example: $val = arrayGet($arr, 'i', 123);

Input
$arr array
scalar $key key
mixed $default default value
Output
mixed  

line 103

arrayMergeTree

public static array arrayMergeTree (array $arr1, array $arr2)

Recursively appends elements of remaining keys from the second array to the first.

Input
array $arr1
array $arr2
Output
array  

line 171

catchError

public static bool catchError (string &$message)

Returns catched error/warning message.

Input
string &$message catched message
Output
bool  

line 73

defaultize

public static void defaultize (mixed &$var, mixed $default)

Initializes variable with $default value.

Input
mixed &$var variable
mixed $default default value
Output
void  

line 122

glob

public static array glob (string $pattern, [int $flags = 0])

Recursive glob(). Finds pathnames matching a pattern.

Input
string $pattern
int $flags
Output
array  

line 58

iniFlag

public static bool iniFlag (string $var)

Gets the boolean value of a configuration option.

Input
string $var configuration option name
Output
bool  

line 157

tryError

public static void tryError ([$level = E_ALL])

Starts catching potential errors/warnings.

Input
$level
Output
void