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

Breadcrumb

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

function SniffLocalCache::setIfNotCached

1 call to SniffLocalCache::setIfNotCached()
SniffLocalCache::getAndSetIfNotCached in vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/SniffLocalCache.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint *

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/SniffLocalCache.php, line 36

Class

SniffLocalCache
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

private static function setIfNotCached(int $fixerLoops, string $internalKey, Closure $lazyValue) : void {
    if (array_key_exists($fixerLoops, self::$cache) && array_key_exists($internalKey, self::$cache[$fixerLoops])) {
        return;
    }
    self::$cache[$fixerLoops][$internalKey] = $lazyValue();
    if ($fixerLoops > 0) {
        unset(self::$cache[$fixerLoops - 1]);
    }
}

API Navigation

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