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

Breadcrumb

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

function Inline::dumpHashArray

Dumps hash array to a YAML string.

Parameters

array|\ArrayObject|\stdClass $value The hash array to dump:

int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string:

2 calls to Inline::dumpHashArray()
Inline::dump in vendor/symfony/yaml/Inline.php
Dumps a given PHP variable to a YAML string.
Inline::dumpArray in vendor/symfony/yaml/Inline.php
Dumps a PHP array to a YAML string.

File

vendor/symfony/yaml/Inline.php, line 242

Class

Inline
Inline implements a YAML parser/dumper for the YAML inline syntax.

Namespace

Symfony\Component\Yaml

Code

private static function dumpHashArray(array|\ArrayObject|\stdClass $value, int $flags) : string {
    $output = [];
    foreach ($value as $key => $val) {
        if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) {
            $key = (string) $key;
        }
        $output[] = \sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags));
    }
    return \sprintf('{ %s }', implode(', ', $output));
}

API Navigation

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