Ejemplo n.º 1
0
 public function importInto(ArrayBase $collection)
 {
     if ($this->iterator instanceof \Iterator) {
         $i = 0;
         foreach ($this->iterator as $key => $row) {
             if ($this->iteratorendindex >= 0 && $i > $this->iteratorendindex) {
                 break;
             } elseif ($i >= $this->iteratorstartindex) {
                 if ($row !== null && $key !== null) {
                     $collection->set($key, $row);
                 }
             }
             $i++;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Diffrence to another object
  * @param \PerrysLambda\ArrayBase $comparedata
  * @return \PerrysLambda\ArrayBase
  */
 public function except(ArrayBase $comparedata)
 {
     $cmpvalue = function ($v1, $v2) {
         return $v1 == $v2 ? 0 : ($v1 > $v2 ? 1 : -1);
     };
     $collection = $this->newInstance();
     $temp1 = array_udiff($this->getData(), $comparedata->getData(), $cmpvalue);
     $temp2 = array_udiff($comparedata->getData(), $this->getData(), $cmpvalue);
     $temp = array_merge($temp1, $temp2);
     unset($temp1, $temp2);
     $collection->setData($temp);
     unset($temp);
     return $collection;
 }