| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | /** |
| 6: | * This file is part of the Nexus framework. |
| 7: | * |
| 8: | * (c) John Paul E. Balandan, CPA <paulbalandan@gmail.com> |
| 9: | * |
| 10: | * For the full copyright and license information, please view |
| 11: | * the LICENSE file that was distributed with this source code. |
| 12: | */ |
| 13: | |
| 14: | namespace Nexus\Collection\Operation; |
| 15: | |
| 16: | use Nexus\Collection\CollectionInterface; |
| 17: | |
| 18: | /** |
| 19: | * @template TKey |
| 20: | * @template T |
| 21: | */ |
| 22: | interface Map |
| 23: | { |
| 24: | /** |
| 25: | * Returns a new collection consisting of items transformed by applying |
| 26: | * the mapping function `$predicate`. |
| 27: | * |
| 28: | * Only the values are passed to the closure. If you want to pass only |
| 29: | * the keys, you need to use `CollectionInterface::mapKeys()`. If you |
| 30: | * want both keys and values, you need `CollectionInterface::mapWithKey()`. |
| 31: | * |
| 32: | * @template U |
| 33: | * |
| 34: | * @param (\Closure(T): U) $predicate |
| 35: | * |
| 36: | * @return CollectionInterface<TKey, U> |
| 37: | */ |
| 38: | public function map(\Closure $predicate): CollectionInterface; |
| 39: | } |
| 40: |