Class Config (namespace Nette\Config)


Configuration storage.

ArrayObject
   |
   --Collection
      |
      --Hashtable
         |
         --Config
Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Config/Config.php (line 33)
Public Method Summary
Config
__construct ([array $arr = NULL], [$flags = self::READONLY])
void
expand ()
Expand all variables.
void
freeze ()
Makes the object unmodifiable.
static Config
fromFile (string $file, [string $section = NULL], [int $flags = self::READONLY])
Creates new configuration object from file.
void
import (array|\Traversable $arr)
Import from array or any traversable object.
static void
registerExtension (string $extension, string $class)
Registers adapter for given file extension.
void
save (string $file, [string $section = NULL])
Save configuration to file.
array
toArray ()
Returns an array containing all of the elements in this collection.
void
__clone ()
Creates a modifiable clone of the object.
& mixed
__get (int $key)
Returns item. Do not call directly.
bool
__isset (string $key)
Exists item?
void
__set (int $key, object $item)
Inserts (replaces) item. Do not call directly.
void
__unset (string $key)
Removes the element at the specified position in this list.
Methods Inherited From Hashtable
add(), append(), get(), getKeys(), import(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), search(), throwKeyNotFound()
Methods Inherited From Collection
__construct(), append(), beforeAdd(), clear(), contains(), exchangeArray(), freeze(), getClass(), getItemType(), getIterator(), import(), isFrozen(), isReadOnly(), remove(), search(), setArray(), setReadOnly(), updating(), __call(), __callStatic(), __clone(), __get(), __isset(), __set(), __unset()
Methods Inherited From ArrayObject (Internal Class)
constructor __construct ( $array ), append ( $value ), asort ( ), count ( ), exchangeArray ( $array ), getArrayCopy ( ), getFlags ( ), getIterator ( ), getIteratorClass ( ), ksort ( ), natcasesort ( ), natsort ( ), offsetExists ( $index ), offsetGet ( $index ), offsetSet ( $index, $newval ), offsetUnset ( $index ), setFlags ( $flags ), setIteratorClass ( $iteratorClass ), uasort ( $cmp_function ), uksort ( $cmp_function )
Constant Summary
int EXPAND 2

line 37

flag
int READONLY 1

line 36

flag
Constants Inherited From ArrayObject (Internal Class)
ARRAY_AS_PROPS = 2, STD_PROP_LIST = 1

Method Details

line 95

__construct

public Config __construct ([array $arr = NULL], [$flags = self::READONLY])

Input
array $arr to wrap
$flags
Output
Config  
Throws
throws InvalidArgumentException

line 139

expand

public void expand ()

Expand all variables.

Output
void  

line 198

freeze

public void freeze ()

Makes the object unmodifiable.

Output
void  

line 77

fromFile

public static Config fromFile (string $file, [string $section = NULL], [int $flags = self::READONLY])

Creates new configuration object from file.

Input
string $file file name
string $section section to load
int $flags flags (readOnly, autoexpand variables)
Output
Config  

line 162

import

public void import (array|\Traversable $arr)

Import from array or any traversable object.

Input
array|\Traversable $arr
Output
void  
Throws
throws InvalidArgumentException

line 54

registerExtension

public static void registerExtension (string $extension, string $class)

Registers adapter for given file extension.

Input
string $extension file extension
string $class class name (IConfigAdapter)
Output
void  

line 118

save

public void save (string $file, [string $section = NULL])

Save configuration to file.

Input
string $file file
string $section section to write
Output
void  

line 181

toArray

public array toArray ()

Returns an array containing all of the elements in this collection.

Output
array  

line 214

__clone

public void __clone ()

Creates a modifiable clone of the object.

Output
void  

line 237

__get

public mixed & __get (int $key)

Returns item. Do not call directly.

Input
int $key index
Output
& mixed  

line 263

__isset

public bool __isset (string $key)

Exists item?

Input
string $key name
Output
bool  

line 251

__set

public void __set (int $key, object $item)

Inserts (replaces) item. Do not call directly.

Input
int $key index
object $item
Output
void  

line 275

__unset

public void __unset (string $key)

Removes the element at the specified position in this list.

Input
string $key name
Output
void