class Random in Schema.org Metatag 7
A class to create random strings for testing.
Hierarchy
- class \Random
Expanded class hierarchy of Random
File
- src/
SchemaMetatagManager.php, line 11 - A generic substitution for Drupal 8 Random utility.
View source
class Random {
/**
* Return a random string of a given length.
*/
public function name($length, $other) {
return $this
->string($length, $other);
}
/**
* Return a random string of a given length.
*/
public function string($length, $other) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randstring = '';
for ($i = 0; $i < $length; $i++) {
$randstring .= $characters[rand(0, strlen($characters) - 1)];
}
return $randstring;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Random:: |
public | function | Return a random string of a given length. | |
Random:: |
public | function | Return a random string of a given length. |