本文整理汇总了PHP中okapi\Okapi::cache_size2_to_oxsize方法的典型用法代码示例。如果您正苦于以下问题:PHP Okapi::cache_size2_to_oxsize方法的具体用法?PHP Okapi::cache_size2_to_oxsize怎么用?PHP Okapi::cache_size2_to_oxsize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类okapi\Okapi
的用法示例。
在下文中一共展示了Okapi::cache_size2_to_oxsize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call
//.........这里部分代码省略.........
case 'nano':
$entry['size'] = 1.0;
break;
# same as micro
# same as micro
case 'micro':
$entry['size'] = 1.0;
break;
case 'small':
$entry['size'] = 2.0;
break;
case 'regular':
$entry['size'] = 3.0;
break;
case 'large':
$entry['size'] = 4.0;
break;
case 'xlarge':
$entry['size'] = 5.0;
break;
case 'other':
$entry['size'] = null;
break;
# same as none
# same as none
default:
throw new Exception();
}
break;
case 'size2':
$entry['size2'] = Okapi::cache_sizeid_to_size2($row['size']);
break;
case 'oxsize':
$entry['oxsize'] = Okapi::cache_size2_to_oxsize(Okapi::cache_sizeid_to_size2($row['size']));
break;
case 'difficulty':
$entry['difficulty'] = round($row['difficulty'] / 2.0, 1);
break;
case 'terrain':
$entry['terrain'] = round($row['terrain'] / 2.0, 1);
break;
case 'trip_time':
# search time is entered in hours:minutes and converted to decimal hours,
# which can produce lots of unneeded decimal places; 2 of them are sufficient here
$entry['trip_time'] = $row['trip_time'] === null ? null : round($row['trip_time'], 2);
break;
break;
case 'trip_distance':
# way length is entered in km as decimal fraction, but number conversions can
# create fake digits which should be stripped; meter precision is sufficient here
$entry['trip_distance'] = $row['trip_distance'] === null ? null : round($row['trip_distance'], 3);
break;
break;
case 'rating':
if ($row['votes'] < 3) {
$entry['rating'] = null;
} elseif ($row['score'] >= 2.2) {
$entry['rating'] = 5.0;
} elseif ($row['score'] >= 1.4) {
$entry['rating'] = 4.0;
} elseif ($row['score'] >= 0.1) {
$entry['rating'] = 3.0;
} elseif ($row['score'] >= -1.0) {
$entry['rating'] = 2.0;
} else {
$entry['rating'] = 1.0;