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

Breadcrumb

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

function AbstractMap::get

Parameters

K $key The key to return from the map.:

T | null $defaultValue The default value to use if `$key` is not found.:

Return value

T | null the value or `null` if the key could not be found.

Overrides MapInterface::get

6 calls to AbstractMap::get()
AbstractMap::put in vendor/ramsey/collection/src/Map/AbstractMap.php
AbstractMap::putIfAbsent in vendor/ramsey/collection/src/Map/AbstractMap.php
AbstractMap::remove in vendor/ramsey/collection/src/Map/AbstractMap.php
AbstractMap::removeIf in vendor/ramsey/collection/src/Map/AbstractMap.php
Removes the entry for the specified key only if it is currently mapped to the specified value.
AbstractMap::replace in vendor/ramsey/collection/src/Map/AbstractMap.php

... See full list

File

vendor/ramsey/collection/src/Map/AbstractMap.php, line 96

Class

AbstractMap
This class provides a basic implementation of `MapInterface`, to minimize the effort required to implement this interface.

Namespace

Ramsey\Collection\Map

Code

public function get(int|string $key, mixed $defaultValue = null) : mixed {
    return $this[$key] ?? $defaultValue;
}

API Navigation

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