You are here

public static function SchemaMetatagManager::randomMachineName in Schema.org Metatag 7

Generates a unique random string containing letters and numbers.

Parameters

int $length: Length of random string to generate.

Return value

string Randomly generated unique string.

Overrides SchemaMetatagManagerInterface::randomMachineName

1 call to SchemaMetatagManager::randomMachineName()
SchemaNameBase::testDefaultValue in src/SchemaNameBase.php
Provide a random test value.

File

src/SchemaMetatagManager.php, line 349
A generic substitution for Drupal 8 Random utility.

Class

SchemaMetatagManager
Class SchemaMetatagManager.

Code

public static function randomMachineName($length = 8) {
  $randomGenerator = new Random();
  return $randomGenerator
    ->name($length, TRUE);
}