當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Okapi::cache_size2_to_oxsize方法代碼示例

本文整理匯總了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;
開發者ID:Slini11,項目名稱:okapi,代碼行數:67,代碼來源:geocaches.php


注:本文中的okapi\Okapi::cache_size2_to_oxsize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。