68 Classifieds API

Features
class tree: 68Classifieds | index: 68Classifieds | all elements

 Class ArrayWrapper

Description

ArrayWrapper class For controlled access and manipulation of associative arrays

  • author: Peter Bailey

Located in /includes/classes/wrapper/ArrayWrapper.php (line 19)


	
			
Direct descendents
Class Description
 class GetWrapper SuperglobalWrapper.php
 class PostWrapper ArrayWrapper class For controlled access and manipulation of associative arrays
 class CookieWrapper ArrayWrapper class For controlled access and manipulation of associative arrays
Variable Summary
 mixed $magic
 mixed $_arr
Method Summary
 ArrayWrapper __construct ( &$arr, array $arr)
 ArrayWrapper ArrayWrapper ( &$arr, array $arr)
 bool exists (string $key)
 bool existsLoose (string $key)
 mixed get (string $key, [mixed $default = false])
 array &getArrayRef ()
 mixed getByIndex (string $key, mixed $index)
 bool remove (string $key)
 void set (string $key, string $value)
 void setArray ( &$array)
 void trim (string $key)
 void trimAll ()
Variables
mixed $magic (line 31)

Boolean indicating status of magic quotes

  • access: public
mixed $_arr (line 25)

Holds reference to array being wrapped

  • access: protected
Methods
Constructor __construct (line 50)

PHP5 Constructor

  • access: public
ArrayWrapper __construct ( &$arr, array $arr)
  • array $arr: Reference to desired associative array
  • &$arr
Constructor ArrayWrapper (line 39)

PHP4 constructor wrapping the PHP5 one for forward compatibility

  • access: public
ArrayWrapper ArrayWrapper ( &$arr, array $arr)
  • array $arr: Reference to desired associative array
  • &$arr
exists (line 120)

Determine if array key exists

  • access: public
bool exists (string $key)
  • string $key: Key to be checked for existence
existsLoose (line 131)

Determine if array key exists OR has usable value

  • access: public
bool existsLoose (string $key)
  • string $key: Key to be checked
get (line 63)

Retrieve value of given key

  • access: public
mixed get (string $key, [mixed $default = false])
  • string $key: Key of value to be retrieved
  • mixed $default: Value to return if key value is not found
getArrayRef (line 185)

Retrieve a reference to the wrapped array

  • access: public
array &getArrayRef ()
getByIndex (line 89)

Retrieve value of given key

  • access: public
mixed getByIndex (string $key, mixed $index)
  • string $key: Key of value to be retrieved
  • mixed $index: Index to retrieve
remove (line 206)

Remove the key/value pair for the given key from the array

  • access: public
bool remove (string $key)
  • string $key: Key to be removed
set (line 109)

Set value of given key

  • access: public
void set (string $key, string $value)
  • string $key: Key of data to replace with $value
  • string $value: New value for $key

Redefined in descendants as:
setArray (line 195)

Set a new wrapped array

  • access: public
void setArray ( &$array)
  • &$array
trim (line 165)

Trim whitespace from string values, recursively if necessary, for the given key

  • access: public
void trim (string $key)
  • string $key: Key of the value to be trimmed
trimAll (line 151)

Apply ArrayWrapper::trim() to each element of the array

void trimAll ()