import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Config
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Config.php 12204 2008-10-30 20:42:37Z dasprid $
|
||||
* @version $Id: Config.php 16091 2009-06-16 19:23:08Z doctorrock83 $
|
||||
*/
|
||||
|
||||
|
||||
@ -56,6 +56,13 @@ class Zend_Config implements Countable, Iterator
|
||||
*/
|
||||
protected $_data;
|
||||
|
||||
/**
|
||||
* Used when unsetting values during iteration to ensure we do not skip
|
||||
* the next element
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_skipNextIteration;
|
||||
|
||||
/**
|
||||
* Contains which config file sections were loaded. This is null
|
||||
@ -190,7 +197,8 @@ class Zend_Config implements Countable, Iterator
|
||||
public function toArray()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->_data as $key => $value) {
|
||||
$data = $this->_data;
|
||||
foreach ($data as $key => $value) {
|
||||
if ($value instanceof Zend_Config) {
|
||||
$array[$key] = $value->toArray();
|
||||
} else {
|
||||
@ -223,6 +231,7 @@ class Zend_Config implements Countable, Iterator
|
||||
if ($this->_allowModifications) {
|
||||
unset($this->_data[$name]);
|
||||
$this->_count = count($this->_data);
|
||||
$this->_skipNextIteration = true;
|
||||
} else {
|
||||
/** @see Zend_Config_Exception */
|
||||
require_once 'Zend/Config/Exception.php';
|
||||
@ -248,6 +257,7 @@ class Zend_Config implements Countable, Iterator
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
$this->_skipNextIteration = false;
|
||||
return current($this->_data);
|
||||
}
|
||||
|
||||
@ -267,6 +277,10 @@ class Zend_Config implements Countable, Iterator
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
if ($this->_skipNextIteration) {
|
||||
$this->_skipNextIteration = false;
|
||||
return;
|
||||
}
|
||||
next($this->_data);
|
||||
$this->_index++;
|
||||
}
|
||||
@ -277,6 +291,7 @@ class Zend_Config implements Countable, Iterator
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->_skipNextIteration = false;
|
||||
reset($this->_data);
|
||||
$this->_index = 0;
|
||||
}
|
||||
@ -298,6 +313,9 @@ class Zend_Config implements Countable, Iterator
|
||||
*/
|
||||
public function getSectionName()
|
||||
{
|
||||
if(is_array($this->_loadedSection) && count($this->_loadedSection) == 1) {
|
||||
$this->_loadedSection = $this->_loadedSection[0];
|
||||
}
|
||||
return $this->_loadedSection;
|
||||
}
|
||||
|
||||
@ -350,6 +368,11 @@ class Zend_Config implements Countable, Iterator
|
||||
public function setReadOnly()
|
||||
{
|
||||
$this->_allowModifications = false;
|
||||
foreach ($this->_data as $key => $value) {
|
||||
if ($value instanceof Zend_Config) {
|
||||
$value->setReadOnly();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user