Skip to content
Permalink
Browse files

Adding some more basic methods.

  • Loading branch information...
markstory committed Dec 4, 2010
1 parent da632fe commit aef53cd23a4181b91b53bbe837e4c4b40327322c
Showing with 20 additions and 3 deletions.
  1. +18 −3 cake/libs/configure.php
  2. +2 −0 cake/tests/cases/libs/configure.test.php
@@ -266,13 +266,13 @@ public static function delete($var = null) {
*
* `Configure::config('ini', new IniReader());`
*
* @param string $alias The name of the reader being configured. This alias is used later to
* @param string $name The name of the reader being configured. This alias is used later to
* read values from a specific reader.
* @param ConfigReaderInterface $reader The reader to append.
* @return void
*/
public static function config($alias, ConfigReaderInterface $reader) {
self::$_readers[$alias] = $reader;
public static function config($name, ConfigReaderInterface $reader) {
self::$_readers[$name] = $reader;
}
/**
@@ -284,6 +284,21 @@ public static function configured() {
return array_keys(self::$_readers);
}
/**
* Remove a configured reader. This will unset the reader
* and make any future attempts to use it cause an Exception.
*
* @param string $name Name of the reader to drop.
* @return boolean Success
*/
public static function drop($name) {
if (!isset(self::$_readers[$name])) {
return false;
}
unset(self::$_readers[$name]);
return true;
}
/**
* Loads a file from app/config/configure_file.php.
*
@@ -269,6 +269,8 @@ function testReaderSetup() {
$configured = Configure::configured();
$this->assertTrue(in_array('test', $configured));
$this->assertTrue(Configure::drop('test'));
$this->assertFalse(Configure::drop('test'), 'dropping things that do not exist should return false.');
}
/**

0 comments on commit aef53cd

Please sign in to comment.
You can’t perform that action at this time.