Class Properties

Description

Reads and writes files in the ".ini" format

The Properties class is able to read sections and their values, as well as to create or change existent sections and keys.

Located in /core/util/Properties.class.php (line 40)

PHP2Go
   |
   --Properties
Variable Summary
Method Summary
Properties Properties (string $filename, [bool $processSections = FALSE], [bool $caseSensitive = FALSE])
void addComment (string $comment, [string $section = NULL])
void addSection (string $section, [bool $overwrite = FALSE], [array $entries = array()])
mixed fetchNextSection ()
mixed getArray (string $key, [string $separator = '|'], [mixed $fallback = array()], [string $section = NULL])
bool getBool (string $key, [mixed $fallback = FALSE], [string $trueValue = '1'], [string $section = NULL])
string getContent ([string $lineEnd = "\n"], [string $indent = ''])
string getCurrentSection ()
string getFirstSection ()
string getNextSection ()
mixed getSection (string $section)
mixed getValue (string $key, [mixed $fallback = NULL], [string $section = NULL])
bool hasSection (string $section)
bool matchValue (string $key, string $pattern, [string $section = NULL])
void reset ()
bool save ([string $lineEnd = "\n"], [string $indent = ''])
void setArray (string $key, array $value, [string $glue = '|'], [string $section = NULL])
void setBool (string $key, bool $value, [string $section = NULL])
void setValue (string $key, string $value, [string $section = NULL])
void _createFile ()
void _loadFile ([unknown_type $force = FALSE])
Variables
bool $caseSensitive (line 72)

Whether read/write of keys should be case-sensitive

  • access: private
string $currentSection = NULL (line 80)

Current section name

  • access: private
string $filename (line 48)

File path

  • access: private
bool $processSections (line 64)

Whether sections should be processed

  • access: private
array $table (line 56)

Properties read from the file

  • access: private
Methods
Constructor Properties (line 90)

Class constructor

Properties Properties (string $filename, [bool $processSections = FALSE], [bool $caseSensitive = FALSE])
  • string $filename: File to be read or written
  • bool $processSections: Process sections?
  • bool $caseSensitive: Case-sensitive keys?
addComment (line 355)

Adds a comment

The comments are always added in the end of sections, or in the end of the file, when the processing of sections is disabled.

void addComment (string $comment, [string $section = NULL])
  • string $comment: Comment
  • string $section: Optional section name
addSection (line 290)

Adds a new section

This section will be set as current section, so that further calls to setValue will add/change keys of this section.

void addSection (string $section, [bool $overwrite = FALSE], [array $entries = array()])
  • string $section: Section name
  • bool $overwrite: Overwrite current entries, if existent
  • array $entries: Section entries
fetchCurrentSection (line 143)

Fetches current section

array fetchCurrentSection ()
fetchFirstSection (line 125)

Fetches the contents of the first section

Returns FALSE when the processing of sections is disabled.

mixed fetchFirstSection ()
fetchNextSection (line 175)

Fetches the next section

Returns FALSE when there is no next action or when processing sections is disabled.

mixed fetchNextSection ()
getArray (line 256)

Reads the value of a key as an array

mixed getArray (string $key, [string $separator = '|'], [mixed $fallback = array()], [string $section = NULL])
  • string $key: Key
  • string $separator: Separator to be used
  • mixed $fallback: Fallback value
  • string $section: Optional section value
getBool (line 272)

Reads the value of a key as boolean

bool getBool (string $key, [mixed $fallback = FALSE], [string $trueValue = '1'], [string $section = NULL])
  • string $key: Key
  • mixed $fallback: Fallback value
  • string $trueValue: Representation of a true value, for comparison purposes
  • string $section: Optional section name
getContent (line 377)

Renders and returns the file contents

string getContent ([string $lineEnd = "\n"], [string $indent = ''])
  • string $lineEnd: Line end string
  • string $indent: Indentation string
getCurrentSection (line 134)

Gets current section name

string getCurrentSection ()
getFirstSection (line 110)

Gets the name of the first section

Returns FALSE when the processing of sections is disabled.

string getFirstSection ()
getNextSection (line 156)

Moves the internal pointer to the next section

Returns the fetched section name, or FALSE when the end was reached or when processing sections is disabled.

  • return: Next section's name
string getNextSection ()
getSection (line 195)

Fetches a section by name

mixed getSection (string $section)
  • string $section: Section name
getValue (line 217)

Reads a value, given its key

If $section is omitted, the current loaded section will be used. The $fallback value will be used when $key is not found.

mixed getValue (string $key, [mixed $fallback = NULL], [string $section = NULL])
  • string $key: Key
  • mixed $fallback: Fallback value
  • string $section: Optional section name
hasSection (line 185)

Checks if a given section exists

bool hasSection (string $section)
  • string $section: Section name
matchValue (line 240)

Checks if the value of a key matches a given pattern

bool matchValue (string $key, string $pattern, [string $section = NULL])
  • string $key: Key
  • string $pattern: Pattern
  • string $section: Optional section name
reset (line 413)

Rebuilds the internal table based on the original file

void reset ()
save (line 424)

Renders and saves the file contents

bool save ([string $lineEnd = "\n"], [string $indent = ''])
  • string $lineEnd: Line end string
  • string $indent: Indentation string
setArray (line 329)

Adds an array key

The array will be imploded using the given $glue string.

void setArray (string $key, array $value, [string $glue = '|'], [string $section = NULL])
  • string $key: Key
  • array $value: Key's value
  • string $glue: Array glue
  • string $section: Optional section name
setBool (line 341)

Adds a boolean key

void setBool (string $key, bool $value, [string $section = NULL])
  • string $key: Key
  • bool $value: Key's value
  • string $section: Optional section name
setValue (line 305)

Adds or changes a key

void setValue (string $key, string $value, [string $section = NULL])
  • string $key: Key
  • string $value: Key's value
  • string $section: Optional section name
_createFile (line 443)

Used to create the file when it doesn't exist

  • access: private
void _createFile ()
_loadFile (line 458)

Used to load the contents of the file

void _loadFile ([unknown_type $force = FALSE])
  • unknown_type $force: Force table rebuild

Inherited Methods

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:28:35 -0300 by phpDocumentor 1.3.2