>> YANA 4 PHP Framework >> Docs For Class Registry

Class Registry

Description

Registry

This class implements a registry. You can operate on it via keys, identifying scalar values or arrays inside the registry.

Example for usage of the $key parameter:

 Array {
     ID1 => Array {
         ID2 => 'value'
     }
 }
To get the string 'value' from the array above use $key = 'ID1.ID2'

The wildcard '*' may be used to refer to the array as a whole.

  • access: public

Located in /includes/class_registry.php

Object
   |
   --InputStream
      |
      --SecureInputStream
         |
         --VDrive
            |
            --Registry
Method Summary
  • mixed getVar ([string $key = "*"])
  • bool merge (string $key, array $array)
  • bool setType (string $key, string $type)
  • bool setVar (string $key, mixed $value)
  • bool setVarByReference (string $key, mixed &$value)
  • bool unsetVar (string $key)

Methods

retrieves var from registry
mixed getVar (
[string $key = "*"]
)
List of parameters:
Name Type Description
$key string (optional)
Description:

This returns the var identified by $key.

Note that you may use the following magic keys FOR THIS FUNCTION ONLY:

  • <BOOLEAN> returns an one-dimensional associative array of all values converted to boolean
  • <STRING> returns an one-dimensional associative array of all values converted to string, arrays are mapped to bool(true)
  • <ARRAY> returns an array of all arrays, scalar values are mapped to an empty array

Returns bool(false) on error;

  • access: public
merges the value at adresse $key with the provided array data
bool merge (
string $key, array $array
)
List of parameters:
Name Type Description
$key string
$array array
Description:

Merges the element identified by $key with the array $value.

Returns bool(false) on error.

  • access: public
sets the type of a var on registry
bool setType (
string $key, string $type
)
List of parameters:
Name Type Description
$key string
$type string
Description:

Set the data type of the element identified by $key to $type.

Returns bool(false) if the element is NULL or does not exist, or the $type parameter is invalid. Returns bool(true) otherwise.

  • access: public
sets var on registry
bool setVar (
string $key, mixed $value
)
List of parameters:
Name Type Description
$key string
$value mixed
Description:

Sets the element identified by $key to $value. If the value does not exist it gets inserted. If a previous value existed the value gets updated.

This function returns bool(false) if $key = '*' and $value is not an array - which is: trying overwrite the complete registry with a non-array value. It returns bool(true) otherwise.

  • access: public
sets var on registry by Reference
bool setVarByReference (
string $key, mixed &$value
)
List of parameters:
Name Type Description
$key string
&$value mixed
Description:

Sets the element identified by $key to $value by passing it's reference. If the value does not exist it gets inserted. If a previous value existed the value gets updated.

This function returns bool(false) if $key = '*' and $value is not an array - which is: trying overwrite the complete registry with a non-array value. It returns bool(true) otherwise.

  • since: 2.8.5
  • access: public
removes var from registry
bool unsetVar (
string $key
)
List of parameters:
Name Type Description
$key string
Description:

Unsets the element identified by $key in the registry. Returns bool(false) if the element does not exist or the key is invalid. Returns bool(true) otherwise.

  • access: public
inherited from base classes

Inherited From VDrive

Inherited From SecureInputStream

Inherited From InputStream

Inherited From Object

Documentation generated on Sun, 11 Mar 2007 15:02:39 +0100 by phpDocumentor 1.3.1

yana author: Thomas MeyerHomepage: www.yanaframework.net