You are here

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

Same name and namespace in other branches
  1. 8 src/SchemaMetatagManager.php \Drupal\schema_metatag\SchemaMetatagManager::randomMachineName()

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

File

src/SchemaMetatagManager.php, line 337

Class

SchemaMetatagManager
The SchemaMetatag Manager.

Namespace

Drupal\schema_metatag

Code

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