本文整理汇总了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);
}