[limb-svn] r7090 - 3.x/trunk/limb/core/src
svn at limb-project.com
svn at limb-project.com
Fri Jul 4 16:19:15 MSD 2008
Author: korchasa
Date: 2008-07-04 16:19:15 +0400 (Fri, 04 Jul 2008)
New Revision: 7090
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7090
Modified:
3.x/trunk/limb/core/src/lmbCollection.class.php
Log:
-- add offset param for add()
-- fix in offsetSet
-- simplify offsetExist
Modified: 3.x/trunk/limb/core/src/lmbCollection.class.php
===================================================================
--- 3.x/trunk/limb/core/src/lmbCollection.class.php 2008-07-04 11:13:42 UTC (rev 7089)
+++ 3.x/trunk/limb/core/src/lmbCollection.class.php 2008-07-04 12:19:15 UTC (rev 7090)
@@ -178,9 +178,13 @@
return (is_array($values) || is_object($values));
}
- function add($item)
+ function add($item, $offset = false)
{
- $this->dataset[] = $item;
+ if($offset)
+ $this->dataset[$offset] = $item;
+ else
+ $this->dataset[] = $item;
+
$this->iteratedDataset = null;
}
@@ -205,19 +209,18 @@
//ArrayAccess interface
function offsetExists($offset)
{
- return !is_null($this->offsetGet($offset));
+ return isset($this->dataset[$offset]);
}
function offsetGet($offset)
{
- if(is_numeric($offset))
- return $this->at((int)$offset);
+ return $this->at((int)$offset);
}
function offsetSet($offset, $value)
{
if(!isset($offset))
- $this->add($value);
+ $this->add($value, $offset);
}
function offsetUnset($offset){}
More information about the limb-svn
mailing list