本文整理汇总了PHP中RandomGenerator::generateEntropy方法的典型用法代码示例。如果您正苦于以下问题:PHP RandomGenerator::generateEntropy方法的具体用法?PHP RandomGenerator::generateEntropy怎么用?PHP RandomGenerator::generateEntropy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RandomGenerator
的用法示例。
在下文中一共展示了RandomGenerator::generateEntropy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGenerateEntropy
function testGenerateEntropy() {
$r = new RandomGenerator();
$this->assertNotNull($r->generateEntropy());
$this->assertNotEquals($r->generateEntropy(), $r->generateEntropy());
}
示例2: generateFilename
/**
* Returns a unique filename, including project/environment/timestamp details.
* @return string
*/
public function generateFilename(DNDataTransfer $dataTransfer)
{
$generator = new RandomGenerator();
$filter = FileNameFilter::create();
return sprintf('%s-%s-%s-%s-%s', $filter->filter(strtolower($this->OriginalEnvironment()->Project()->Name)), $filter->filter(strtolower($this->OriginalEnvironment()->Name)), $dataTransfer->Mode, date('Ymd'), sha1($generator->generateEntropy()));
}
示例3: generateFilename
/**
* Returns a unique filename, including project/environment/timestamp details.
* @return string
*/
public function generateFilename(DNDataTransfer $dataTransfer)
{
$generator = new RandomGenerator();
$sanitizeRegex = array('/\\s+/', '/[^a-zA-Z0-9-_\\.]/');
$sanitizeReplace = array('/_/', '');
$envName = strtolower(preg_replace($sanitizeRegex, $sanitizeReplace, $this->OriginalEnvironment()->Name));
$projectName = strtolower(preg_replace($sanitizeRegex, $sanitizeReplace, $this->OriginalEnvironment()->Project()->Name));
return sprintf('%s-%s-%s-%s-%s', $projectName, $envName, $dataTransfer->Mode, date('Ymd'), sha1($generator->generateEntropy()));
}