本文整理匯總了PHP中TextHelper::loadSimpleList方法的典型用法代碼示例。如果您正苦於以下問題:PHP TextHelper::loadSimpleList方法的具體用法?PHP TextHelper::loadSimpleList怎麽用?PHP TextHelper::loadSimpleList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TextHelper
的用法示例。
在下文中一共展示了TextHelper::loadSimpleList方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadBannedFranchiseCoupling
private static function loadBannedFranchiseCoupling()
{
$lines = TextHelper::loadSimpleList(Config::$bannedFranchiseCouplingListPath);
$lines[] = '---';
$groups = [];
$reset = true;
$key = 0;
$group = [];
foreach ($lines as $line) {
if (preg_match('/^-+$/', $line)) {
if (!empty($group)) {
$groups[$key] = $group;
++$key;
}
$group = [];
continue;
}
$group[] = $line;
}
$ret = [];
foreach ($groups as $group) {
foreach ($group as $key) {
$ret[$key] = array_combine($group, array_fill(0, count($group), true));
unset($ret[$key][$key]);
}
}
return $ret;
}
示例2: addRecsFromStaticRecommendations
private static function addRecsFromStaticRecommendations($media)
{
$staticRecIds = TextHelper::loadSimpleList(Config::$staticRecommendationListPath);
$weights = [];
foreach ($staticRecIds as $id) {
$recMedia = substr($id, 0, 1);
if ($recMedia == $media) {
$weights[$id] = null;
}
}
return $weights;
}
示例3: doInit
public static function doInit()
{
$list = TextHelper::loadSimpleList(Config::$bannedUsersListPath);
foreach ($list as $line) {
$tmp = strpos($line, "\t") === false ? [$line, self::USER_BAN_TOTAL] : explode("\t", $line);
list($userName, $banType) = $tmp;
self::$bannedUsers[strtolower($userName)] = $banType;
}
self::$bannedGenres = TextHelper::loadSimpleList(Config::$bannedGenresListPath);
self::$bannedCreators = TextHelper::loadSimpleList(Config::$bannedCreatorsListPath);
self::$bannedGenresForRecs = TextHelper::loadSimpleList(Config::$bannedGenresForRecsListPath);
self::$bannedFranchiseCoupling = TextHelper::loadJson(Config::$bannedFranchiseCouplingListPath, true);
}