Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CollectionInterface.php

function CollectionInterface::map

Apply a given callback method on each item of the collection.

This will always leave the original collection untouched. The new collection is created by mapping the callback to each item of the original collection.

See the {@link http://php.net/manual/en/function.array-map.php PHP array_map() documentation} for examples of how the `$callback` parameter works.

@template TCallbackReturn

Parameters

callable(T): TCallbackReturn $callback A callable to apply to each: item of the collection.

Return value

CollectionInterface<TCallbackReturn>

1 method overrides CollectionInterface::map()
AbstractCollection::map in vendor/ramsey/collection/src/AbstractCollection.php
@template TCallbackReturn

File

vendor/ramsey/collection/src/CollectionInterface.php, line 194

Class

CollectionInterface
A collection represents a group of values, known as its elements.

Namespace

Ramsey\Collection

Code

public function map(callable $callback) : self;

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal