Skip to content

Commit

Permalink
moving Collection::append() to CollectionTrait, I inteded to add it
Browse files Browse the repository at this point in the history
there in the first place
  • Loading branch information
lorenzo committed Dec 28, 2013
1 parent dbe58d7 commit 8196d66
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 0 additions & 15 deletions Cake/Collection/Collection.php
Expand Up @@ -14,7 +14,6 @@
*/
namespace Cake\Collection;

use AppendIterator;
use ArrayIterator;
use Cake\Collection\CollectionTrait;
use InvalidArgumentException;
Expand Down Expand Up @@ -58,18 +57,4 @@ public function getIterator() {
return $this->_iterator;
}

/**
* Returns a new collection as the result of concatenating the list of elements
* in this collection with the passed list of elements
*
* @param array|\Traversable
* @return \Cake\Collection\Collection
*/
public function append($items) {
$list = new AppendIterator;
$list->append($this);
$list->append(new self($items));
return new self($list);
}

}
15 changes: 15 additions & 0 deletions Cake/Collection/CollectionTrait.php
Expand Up @@ -14,6 +14,7 @@
*/
namespace Cake\Collection;

use AppendIterator;
use Cake\Collection\Collection;
use Cake\Collection\Iterator\ExtractIterator;
use Cake\Collection\Iterator\FilterIterator;
Expand Down Expand Up @@ -602,6 +603,20 @@ public function firstMatch(array $conditions) {
return null;
}

/**
* Returns a new collection as the result of concatenating the list of elements
* in this collection with the passed list of elements
*
* @param array|\Traversable
* @return \Cake\Collection\Collection
*/
public function append($items) {
$list = new AppendIterator;
$list->append($this);
$list->append(new Collection($items));
return new Collection($list);
}

/**
* Returns an array representation of the results
*
Expand Down

0 comments on commit 8196d66

Please sign in to comment.