From a305c41c330c16c9b2a0e89f268e51b7f6fcc38b Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 24 Jul 2016 20:35:06 -0500 Subject: [PATCH] remove duplicate method --- src/Illuminate/Support/Collection.php | 14 -------------- tests/Support/SupportCollectionTest.php | 18 ------------------ 2 files changed, 32 deletions(-) diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index 9159b090a3e6..a6a79271c940 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -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. * diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 582207091633..fe7b71b8e2b1 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -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