function PerformanceTestTrait::quoteQueryArgs

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/PerformanceTestTrait.php \Drupal\Tests\PerformanceTestTrait::quoteQueryArgs()

Wraps query arguments in double quotes if they're a string.

Parameters

array $args: The raw query arguments.

Return value

array The conditionally quoted query arguments.

1 call to PerformanceTestTrait::quoteQueryArgs()
PerformanceTestTrait::logQuery in core/tests/Drupal/Tests/PerformanceTestTrait.php
Logs a query in the performance data.

File

core/tests/Drupal/Tests/PerformanceTestTrait.php, line 264

Class

PerformanceTestTrait
Provides various methods to aid in collecting performance data during tests.

Namespace

Drupal\Tests

Code

protected static function quoteQueryArgs(array $args) : array {
    $conditionalQuote = function ($arg) {
        return is_int($arg) || is_float($arg) ? $arg : '"' . $arg . '"';
    };
    return array_map($conditionalQuote, $args);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.