Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FIX Make sure ArrayList#limit uses clone so for subclasses it returns…

… instances of same subclass
  • Loading branch information...
commit 9979b11b59483c7178500b07d0b636ac99d76246 1 parent 27113f8
Hamish Friedlander hafriedlander authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 model/ArrayList.php
4 model/ArrayList.php
View
@@ -130,7 +130,9 @@ public function toNestedArray() {
* @return ArrayList
*/
public function limit($length, $offset = 0) {
- return new ArrayList(array_slice($this->items, $offset, $length));
+ $list = clone $this;
+ $list->items = array_slice($this->items, $offset, $length);
+ return $list;
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.