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

Breadcrumb

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

function ArrayHelper::getIndentation

*

Parameters

list<ArrayKeyValue> $keyValues:

1 call to ArrayHelper::getIndentation()
AlphabeticallySortedByKeysSniff::fix in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/AlphabeticallySortedByKeysSniff.php
*

File

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

Class

ArrayHelper
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public static function getIndentation(array $keyValues) : ?string {
    $indents = [];
    foreach ($keyValues as $keyValue) {
        $indent = $keyValue->getIndent() ?? 'null';
        $indents[$indent] = isset($indents[$indent]) ? $indents[$indent] + 1 : 1;
    }
    arsort($indents);
    $indent = key($indents);
    return $indent !== 'null' ? (string) $indent : null;
}

API Navigation

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