Skip to content

Commit

Permalink
remove duplicate method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 25, 2016
1 parent b5fb5e3 commit a305c41
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
14 changes: 0 additions & 14 deletions src/Illuminate/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,20 +564,6 @@ public function map(callable $callback)
return new static(array_combine($keys, $items));
}

/**
* Run a map over each key of the items.
*
* @param callable $callback
* @return static
*/
public function mapKeys(callable $callback)
{
return new static(array_combine(
array_map($callback, array_keys($this->items), $this->items),
array_values($this->items)
));
}

/**
* Map a collection and flatten the result by a single level.
*
Expand Down
18 changes: 0 additions & 18 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1354,24 +1354,6 @@ public function testWithMultipleModeValues()
$collection = new Collection([1, 2, 2, 1]);
$this->assertEquals([1, 2], $collection->mode());
}

public function testKeyMapUsingKeysOnly()
{
$data = new Collection(['foo' => 'something', 'bar' => 'else']);
$data = $data->mapKeys(function ($key) {
return '-'.$key.'-';
});
$this->assertEquals(['-foo-' => 'something', '-bar-' => 'else'], $data->all());
}

public function testKeyMapUsingKeysAndValues()
{
$data = new Collection(['foo' => 'something', 'bar' => 'else']);
$data = $data->mapKeys(function ($key, $item) {
return $key.'-'.$item;
});
$this->assertEquals(['foo-something' => 'something', 'bar-else' => 'else'], $data->all());
}
}

class TestAccessorEloquentTestStub
Expand Down

0 comments on commit a305c41

Please sign in to comment.