Skip to content

Commit

Permalink
Updating docs for Configure classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 26, 2011
1 parent c35d52e commit f534ea0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
31 changes: 24 additions & 7 deletions lib/Cake/Configure/IniReader.php
Expand Up @@ -23,14 +23,29 @@
* regards to boolean and null values.
*
* In addition to the native parse_ini_file features, IniReader also allows you
* to create nested array structures through usage of . delimited names. This allows
* to create nested array structures through usage of `.` delimited names. This allows
* you to create nested arrays structures in an ini config file. For example:
*
* `db.password = secret` would turn into `array('db' => array('password' => 'secret'))`
*
* You can nest properties as deeply as needed using .'s. IniReader also manipulates
* how the special ini values of 'yes', 'no', 'on', 'off', 'null' are handled.
* These values will be converted to their boolean equivalents.
* You can nest properties as deeply as needed using `.`'s. In addition to using `.` you
* can use standard ini section notation to create nested structures:
*
* {{{
* [section]
* key = value
* }}}
*
* Once loaded into Configure, the above would be accessed using:
*
* `Configure::read('section.key');
*
* You can combine `.` separated values with sections to create more deeply
* nested structures.
*
* IniReader also manipulates how the special ini values of
* 'yes', 'no', 'on', 'off', 'null' are handled. These values will be
* converted to their boolean equivalents.
*
* @package cake.config
* @see http://php.net/parse_ini_file
Expand All @@ -56,7 +71,8 @@ class IniReader implements ConfigReaderInterface {
* ini files that are on the filesystem.
*
* @param string $path Path to load ini config files from.
* @param string $section Only get one section.
* @param string $section Only get one section, leave null to parse and fetch
* all sections in the ini file.
*/
public function __construct($path, $section = null) {
$this->_path = $path;
Expand All @@ -66,7 +82,8 @@ public function __construct($path, $section = null) {
/**
* Read an ini file and return the results as an array.
*
* @param string $file Name of the file to read.
* @param string $file Name of the file to read. The chosen file
* must be on the reader's path.
* @return array
*/
public function read($file) {
Expand Down Expand Up @@ -116,4 +133,4 @@ protected function _parseNestedValues($values) {
}
return $values;
}
}
}
8 changes: 5 additions & 3 deletions lib/Cake/Configure/PhpReader.php
Expand Up @@ -21,6 +21,9 @@
* PHP Reader allows Configure to load configuration values from
* files containing simple PHP arrays.
*
* Files compatible with PhpReader should define a `$config` variable, that
* contains all of the configuration data contained in the file.
*
* @package cake.libs.config
*/
class PhpReader implements ConfigReaderInterface {
Expand All @@ -46,12 +49,11 @@ public function __construct($path = null) {
/**
* Read a config file and return its contents.
*
* Keys with `.` will be treated as values in plugins. Instead of reading from
* Files with `.` in the name will be treated as values in plugins. Instead of reading from
* the initialized path, plugin keys will be located using App::pluginPath().
*
*
* @param string $key The identifier to read from. If the key has a . it will be treated
* as a plugin prefix.
* as a plugin prefix.
* @return array Parsed configuration values.
* @throws ConfigureException when files don't exist or they don't contain `$config`.
* Or when files contain '..' as this could lead to abusive reads.
Expand Down

0 comments on commit f534ea0

Please sign in to comment.