Skip to content
Permalink
Browse files

Added a couple missing doc blocks

  • Loading branch information...
lorenzo committed Dec 25, 2013
1 parent de59315 commit f3297a2cf19b68ce6a29595b6881682639790b54
Showing with 21 additions and 2 deletions.
  1. +9 −0 Cake/Test/TestCase/Utility/Iterator/FilterIteratorTest.php
  2. +12 −2 Cake/Utility/Collection.php
@@ -17,8 +17,17 @@
use Cake\TestSuite\TestCase;
use Cake\Utility\Iterator\FilterIterator;
/**
* FilterIterator test
*
*/
class FilterIteratorTest extends TestCase {
/**
* Tests that the iterator works correctly
*
* @return void
*/
public function testFilter() {
$items = new \ArrayIterator([1, 2, 3]);
$callable = $this->getMock('stdClass', ['__invoke']);
@@ -66,8 +66,18 @@ public function each(callable $c) {
* returns true will be present in the resulting collection.
*
* Each time the callback is executed it will receive the value of the element
* in the current iteration, the key of the element and the passed $items iterator
* as arguments, in that order.
* in the current iteration, the key of the element and this collection as
* arguments, in that order.
*
* ##Example:
*
* Filtering even numbers in an array:
*
* {{{
* $collection = (new Collection([1, 2, 3]))->filter(function($value, $key) {
* return $value % 2 === 0;
* });
* }}}
*
* @param callable $c the method that will receive each of the elements and
* returns true whether or not they should be in the resulting collection.

0 comments on commit f3297a2

Please sign in to comment.
You can’t perform that action at this time.