static function Util::randomProtocol in X Autoload 7.4
Same name and namespace in other branches
- 7.5 src/Util.php \Drupal\xautoload\Util::randomProtocol()
Generate a random string that is a stream wrapper protocol.
Parameters
int $length: Length of the random string to generate
Return value
string Random string of the specified length
File
- lib/
Util.php, line 77
Class
- Util
- A number of static methods that don't interact with any global state.
Namespace
Drupal\xautoloadCode
static function randomProtocol($length = 40) {
// Since PHP is case insensitive, we only user lowercase characters.
$chars_first = 'abcdefghijklmnopqrstuvwxyz_';
$chars = 'abcdefghijklmnopqrstuvwxyz_1234567890';
return self::randomString($length, $chars, $chars_first);
}