Channel.php
934 Bytes
<?php
namespace Plugin\DataProcess\WebChannel;
class Channel
{
public static $formatChannel = array(
'boys' => '\Plugin\DataProcess\WebChannel\Channel\Boys',
'girls' => '\Plugin\DataProcess\WebChannel\Channel\Girls',
'kids' => '\Plugin\DataProcess\WebChannel\Channel\Kids',
'lifestyle' => '\Plugin\DataProcess\WebChannel\Channel\Lifestyle'
);
public static function getFormat($channel, $data)
{
if(empty($data)) {
return array();
}
// 通用处理器
$result = Process::getContent($data, $channel);
$channelResult = array();
if (isset(self::$formatChannel[$channel])) {
$class = self::$formatChannel[$channel];
$channelResult = $class::format($data);
}
// 组合数据
$result = $result + $channelResult;
ksort($result);
return array_values($result);
}
}