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

Breadcrumb

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

function ArrayHelper::isSortedByKey

*

Parameters

list<ArrayKeyValue> $keyValues:

1 call to ArrayHelper::isSortedByKey()
AlphabeticallySortedByKeysSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/AlphabeticallySortedByKeysSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/ArrayHelper.php, line 164

Class

ArrayHelper
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public static function isSortedByKey(array $keyValues) : bool {
    $previousKey = '';
    foreach ($keyValues as $keyValue) {
        if ($keyValue->isUnpacking()) {
            continue;
        }
        if (strnatcasecmp($previousKey, $keyValue->getKey()) === 1) {
            return false;
        }
        $previousKey = $keyValue->getKey();
    }
    return true;
}

API Navigation

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