30 if (!defined(
'PHPEXCEL_ROOT')) {
34 define(
'PHPEXCEL_ROOT', dirname(__FILE__) .
'/../');
38 require_once PHPEXCEL_ROOT .
'PHPExcel/IComparable.php';
72 if (!is_null($pSource)) {
86 if ($pSource == null) {
88 }
else if (!is_array($pSource)) {
89 throw new Exception(
'Invalid array parameter passed.');
92 foreach ($pSource as $item) {
106 $hashIndex = $pSource->getHashIndex();
107 if ( is_null ( $hashIndex ) ) {
108 $hashCode = $pSource->getHashCode();
109 }
else if ( isset ( $this->_keyMap[$hashIndex] ) ) {
110 $hashCode = $this->_keyMap[$hashIndex];
112 $hashCode = $pSource->getHashCode();
116 if (!isset($this->_items[ $hashCode ])) {
117 $this->_items[ $hashCode ] = $pSource;
118 $index =
count($this->_items) - 1;
119 $this->_keyMap[ $index ] = $hashCode;
120 $pSource->setHashIndex( $index );
122 $pSource->setHashIndex( $this->_items[ $hashCode ]->getHashIndex() );
133 if (isset($this->_items[ $pSource->getHashCode() ])) {
134 unset($this->_items[ $pSource->getHashCode() ]);
137 foreach ($this->_keyMap as
$key => $value) {
138 if ($deleteKey >= 0) {
139 $this->_keyMap[
$key - 1] = $value;
142 if ($value == $pSource->getHashCode()) {
146 unset($this->_keyMap[
count($this->_keyMap) - 1 ]);
155 $this->_items = array();
156 $this->_keyMap = array();
165 return count($this->_items);
175 return array_search($pHashCode, $this->_keyMap);
186 if (isset($this->_keyMap[$pIndex])) {
201 if (isset($this->_items[$pHashCode])) {
202 return $this->_items[$pHashCode];
221 $vars = get_object_vars($this);
222 foreach ($vars as
$key => $value) {
223 if (is_object($value)) {
224 $this->
$key = clone $value;