You are here

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

Same name and namespace in other branches
  1. 8.2 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

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

File

src/SchemaMetatagManager.php, line 335

Class

SchemaMetatagManager
Class SchemaMetatagManager.

Namespace

Drupal\schema_metatag

Code

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