本文整理汇总了PHP中Assert::isId方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::isId方法的具体用法?PHP Assert::isId怎么用?PHP Assert::isId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert
的用法示例。
在下文中一共展示了Assert::isId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isIdArray
public function isIdArray($num, $message = null)
{
if (!$message) {
$message = "check for id array";
}
if (is_array($num)) {
if (count($num) > 0) {
for ($i = 0; $i < count($num); $i++) {
Assert::isId($num[$i], $message . ", id at index " . $i . " invalid");
}
} else {
trigger_error($message . ", id array is empty", E_USER_ERROR);
}
} else {
Assert::isId($num, $message . ", ");
}
}
示例2: highscore_list
function highscore_list($filter, $pages, $page = 1, $rows = 50)
{
Assert::isId($page);
Assert::isId($rows);
if ($filter['hours'] || $filter['days']) {
if ($filter['hours']) {
Assert::isNumeric($filter['hours']);
$timeout = date("Y-m-d H:m:s", time() - (int) $filter['hours'] * 60 * 60);
} else {
Assert::isNumeric($filter['days']);
$timeout = date("Y-m-d H:m:s", time() - (int) $filter['days'] * 24 * 60 * 60);
}
$count = selectsql("\n select count(*) as count\n from user u\n left join activity a on (a.uid = u.uid)\n where a.stamp > '{$timeout}'\n group by u.uid\n ");
$count = count($count);
#Seitenamzahl berechnen
$pages = ceil($count / $rows);
#Seite checken
if ($pages < $page && $pages != 0) {
$page = $pages;
}
$result = selectsql("\n select u.*,ga.*,a.*,sum(ac.bonus) as activity_points\n from user u\n left join activity ac on (ac.uid = u.uid)\n left join galaxy ga on (ga.gala = u.gala)\n left join alliance a on(a.aid = ga.aid)\n where ac.stamp > '{$timeout}'\n group by u.uid\n order by activity_points desc, u.nick asc\n LIMIT " . $rows * ($page - 1) . ",{$rows}\n ");
} else {
$count = selectsqlLine("\n select count(*) as count\n from user u\n ");
#Seitenamzahl berechnen
$pages = ceil($count['count'] / $rows);
#Seite checken
if ($pages < $page && $pages != 0) {
$page = $pages;
}
$result = selectsql("\n select * from user u\n left join galaxy ga on (ga.gala = u.gala)\n left join alliance a on(a.aid = ga.aid)\n order by u.activity_points desc, u.nick asc\n LIMIT " . $rows * ($page - 1) . ",{$rows}\n ");
}
for ($i = 0; $i < count($result); $i++) {
$result[$i]['place'] = $rows * ($page - 1) + $i + 1;
}
return $result;
}
示例3: fleet_update
function fleet_update($fid, $fleet)
{
Assert::isId($fid);
$logger =& LoggerManager::getLogger("db.takscreen");
$logger->debug(array("function" => "fleet_update", "fid" => $fid, "fleet" => $fleet));
$checkfleet = array("jaeger", "bomber", "fregatten", "zerstoerer", "kreuzer", "schlachter", "traeger", "kleptoren", "cancris");
$update = array();
foreach ($checkfleet as $key) {
if (isset($fleet[$key]) && is_numeric($fleet[$key])) {
$update[] = "{$key} = " . (int) $fleet[$key];
} else {
$update[] = "{$key} = 0";
}
}
return query("\n update fleet set " . join(",", $update) . " where fid = {$fid}\n ");
$logger->debug("fleetupdate done");
}
示例4: miliscan_fleet_get_bykoords
function miliscan_fleet_get_bykoords($gala, $pos, $num)
{
Assert::isId($gala);
Assert::isId($pos);
Assert::isNumeric($num);
return selectsqlline("\n select * from scans s\n left join scanmili_fleet mf using(sid)\n left join fleet f on (f.fid = mf.fid)\n where s.gala = {$gala} and s.pos = {$pos} and mf.num = {$num}\n ");
}