本文整理汇总了PHP中Engine::generateRandomString方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::generateRandomString方法的具体用法?PHP Engine::generateRandomString怎么用?PHP Engine::generateRandomString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine::generateRandomString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
//Create the functions we want to use, the anonymous functions can ONLY be created at class initialisation
$this->asyncFunctions = array("Getting profile data" => function () {
$this->getUserDataFromUserFunction('getUserProfile');
}, "Getting user posts" => function () {
$this->getUserDataFromUserFunction('getUserPosts');
}, "Getting liked pages" => function () {
$this->getUserDataFromUserFunction('getUserLikes');
}, "Getting user photos" => function () {
$this->getUserDataFromUserFunction('getUserPhotos');
}, "Getting user videos" => function () {
$this->getUserDataFromUserFunction('getUserVideos');
}, "Getting liked movies" => function () {
$this->getUserDataFromUserFunction('getUserMovies');
}, "Getting liked music" => function () {
$this->getUserDataFromUserFunction('getUserMusic');
}, "Getting liked books" => function () {
$this->getUserDataFromUserFunction('getUserBooks');
}, "Analysing post interaction" => function () {
$interaction = new PostInteraction();
$this->data[self::OUT]['interaction'] = $interaction->analyse($this->data[self::IN]);
}, "Analysing activity" => function () {
//Apply another analysis
$activity = new ActivityAnalysis();
$this->data[self::OUT]['activity'] = $activity->analyse($this->data[self::IN]);
}, "Analysing birthdate" => function () {
//Apply horoscope analysis
$horoscope = new HoroscopeAnalysis();
$this->data[self::OUT]['horoscope'] = $horoscope->analyse($this->data[self::IN]);
}, "Creating analysis" => function () {
//Save *other* information for the Facebook share button
//Save the user's name - we can get this in the database but this is just easier for now.
$this->data[self::OUT]['name'] = User::instance()->name;
//Generate a code we can use to show the result to the user
$this->data[self::OUT]['analysis-id'] = Engine::generateRandomString(8);
$this->data[self::OUT]['share-url'] = Engine::getRemoteAbsolutePath((new Result())->getURL() . $this->data[self::OUT]['analysis-id']);
$this->data[self::OUT]['share-title'] = "Click to see my analysis!";
$this->data[self::OUT]['share-description'] = User::instance()->name . " has shared a Facebook Analysis with you. Click to see their result or create your own... What type of Facebook user are you?";
$this->data[self::OUT]['share-image-url'] = Engine::getRemoteAbsolutePath((new Result())->getURL() . $this->data[self::OUT]['analysis-id'] . '/image/');
});
}
示例2: test_generateRandomString
public function test_generateRandomString()
{
//We can only test length
//We can't really test against a random, not in this function anyways.
$this->assertEquals(10, strlen(Engine::generateRandomString(10)));
}