本文整理匯總了PHP中IO::badRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::badRequest方法的具體用法?PHP IO::badRequest怎麽用?PHP IO::badRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IO
的用法示例。
在下文中一共展示了IO::badRequest方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createUser
public function createUser($args)
{
$io = new IO();
$googleId = 0;
$twitterId = 0;
if (!isset($args["displayName"])) {
return $io->badRequest("Display was missing", $args);
} else {
$displayName = $args["displayName"];
}
if (!isset($args["icon"])) {
return $io->badRequest("Icon was missing", $args);
} else {
$icon = $args["icon"];
}
if (isset($args["googleId"])) {
$googleId = $args["googleId"];
}
if (isset($args["twitterId"])) {
$twitterId = $args["twitterId"];
}
$query = "SELECT user_access_token, user_renew_token, user_access_token_expire FROM user WHERE user_google_id = :google OR user_twitter_id = :twitter";
$bindings = [];
$bindings[":google"] = $googleId;
$bindings[":twitter"] = $twitterId;
$results = $this->io->queryDB($args, $query, $bindings);
if (count($results["data"]) == 1) {
$data = [];
$data["accessToken"] = $results["data"][0]["user_access_token"];
$data["renewToken"] = $results["data"][0]["user_renew_token"];
$data["tokenExpire"] = $results["data"][0]["user_access_token_expire"];
$results["data"] = $data;
return $results;
}
if (isset($args["googleId"])) {
return $this->addUserToDatabaseForGoogleId($displayName, $icon, $googleId);
}
if (isset($args["twitterId"])) {
return $this->addUserToDatabaseForTwitterId($displayName, $icon, $twitterId);
}
}