Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/IterableObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,6 @@ public function map($map)
return new self($this->iterable, $this->filter, $map);
}

/**
* @param callable $filter
* @return self
* @deprecated Use IterableObject::filter instead.
*/
public function withFilter($filter)
{
return $this->filter($filter);
}

/**
* @param callable $map
* @return self
* @deprecated Use IterableObject::map instead.
*/
public function withMap($map)
{
return $this->map($map);
}

/**
* @inheritdoc
*/
Expand Down
32 changes: 0 additions & 32 deletions tests/TestIterableObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,38 +43,6 @@ public function testFromTraversableToArray($data, $filter = null, $map = null, $
$this->assertEquals($expectedResult, $iterableObject->asArray());
}

public function testFilterMutator()
{
$filter = function ($value) {
return 'bar' === $value;
};
$iterableObject = iterable(array('foo', 'bar'))->withFilter($filter);
$this->assertEquals(array(1 => 'bar'), iterator_to_array($iterableObject));
}

public function testMapMutator()
{
$map = 'strtoupper';
$iterableObject = iterable(array('foo', 'bar'))->withMap($map);
$this->assertEquals(array('FOO', 'BAR'), iterator_to_array($iterableObject));
}

public function testFilterAndMapMutators()
{
$filter = function ($value) {
return 'bar' === $value;
};
$map = 'strtoupper';
$iterableObject = iterable(array('foo', 'bar'))->withMap($map)->withFilter($filter);
$this->assertEquals(array(1 => 'BAR'), iterator_to_array($iterableObject));
$iterableObject = iterable(array('foo', 'bar'))->map($map)->filter($filter);
$this->assertEquals(array(1 => 'BAR'), iterator_to_array($iterableObject));
$iterableObject = iterable(array('foo', 'bar'))->withFilter($filter)->withMap($map);
$this->assertEquals(array(1 => 'BAR'), iterator_to_array($iterableObject));
$iterableObject = iterable(array('foo', 'bar'))->filter($filter)->map($map);
$this->assertEquals(array(1 => 'BAR'), iterator_to_array($iterableObject));
}

public function dataProvider()
{
$data = array('foo', 'bar');
Expand Down