00001 <?php 00031 class Zend_Mail_Storage_Folder implements RecursiveIterator 00032 { 00037 protected $_folders; 00038 00043 protected $_localName; 00044 00049 protected $_globalName; 00050 00055 protected $_selectable = true; 00056 00065 public function __construct($localName, $globalName = '', $selectable = true, array $folders = array()) 00066 { 00067 $this->_localName = $localName; 00068 $this->_globalName = $globalName ? $globalName : $localName; 00069 $this->_selectable = $selectable; 00070 $this->_folders = $folders; 00071 } 00072 00078 public function hasChildren() 00079 { 00080 $current = $this->current(); 00081 return $current && $current instanceof Zend_Mail_Storage_Folder && !$current->isLeaf(); 00082 } 00083 00089 public function getChildren() 00090 { 00091 return $this->current(); 00092 } 00093 00099 public function valid() 00100 { 00101 return key($this->_folders) !== null; 00102 } 00103 00109 public function next() 00110 { 00111 next($this->_folders); 00112 } 00113 00119 public function key() 00120 { 00121 return key($this->_folders); 00122 } 00123 00129 public function current() 00130 { 00131 return current($this->_folders); 00132 } 00133 00139 public function rewind() 00140 { 00141 reset($this->_folders); 00142 } 00143 00151 public function __get($name) 00152 { 00153 if (!isset($this->_folders[$name])) { 00157 require_once 'Zend/Mail/Storage/Exception.php'; 00158 throw new Zend_Mail_Storage_Exception("no subfolder named $name"); 00159 } 00160 00161 return $this->_folders[$name]; 00162 } 00163 00171 public function __set($name, Zend_Mail_Storage_Folder $folder) 00172 { 00173 $this->_folders[$name] = $folder; 00174 } 00175 00182 public function __unset($name) 00183 { 00184 unset($this->_folders[$name]); 00185 } 00186 00192 public function __toString() 00193 { 00194 return (string)$this->getGlobalName(); 00195 } 00196 00202 public function getLocalName() 00203 { 00204 return $this->_localName; 00205 } 00206 00212 public function getGlobalName() 00213 { 00214 return $this->_globalName; 00215 } 00216 00222 public function isSelectable() 00223 { 00224 return $this->_selectable; 00225 } 00226 00232 public function isLeaf() 00233 { 00234 return empty($this->_folders); 00235 } 00236 }