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

Breadcrumb

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

function AbstractCollection::reduce

@template TCarry

Parameters

callable(TCarry, T): TCarry $callback A callable to apply to each: item of the collection to reduce it to a single value.

TCarry $initial This is the initial value provided to the callback.:

Return value

TCarry

Overrides CollectionInterface::reduce

File

vendor/ramsey/collection/src/AbstractCollection.php, line 245

Class

AbstractCollection
This class provides a basic implementation of `CollectionInterface`, to minimize the effort required to implement this interface

Namespace

Ramsey\Collection

Code

public function reduce(callable $callback, mixed $initial) : mixed {
    
    /** @var TCarry */
    return array_reduce($this->data, $callback, $initial);
}

API Navigation

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