src/AppBundle/Component/OAuthClient/OAuthClientFactory.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Component\OAuthClient;
use Biz\Common\CommonException;
use Topxia\Service\Common\ServiceKernel;
class OAuthClientFactory
{
/**
* 创建OAuthClient实例.
*
* @param string $type Client的类型
* @param array $config 必需包含key, secret两个参数
*
* @return AbstractOauthClient
*/
public static function create($type, array $config)
{
if (!array_key_exists('key', $config) || !array_key_exists('secret', $config)) {
throw CommonException::ERROR_PARAMETER_MISSING();
}
$clients = self::clients();
if (!array_key_exists($type, $clients)) {
throw CommonException::ERROR_PARAMETER();
}
$class = $clients[$type]['class'];
return new $class($config);
}
public static function clients()
{
$clients = array(
'weibo' => array(
'name' => '微博帐号',
'admin_name' => '微博登录接口',
'class' => 'AppBundle\Component\OAuthClient\WeiboOAuthClient',
'icon_class' => 'weibo',
'icon_img' => '',
'large_icon_img' => 'assets/img/social/weibo.png',
'key_setting_label' => 'App Key',
'secret_setting_label' => 'App Secret',
'apply_url' => 'http://open.weibo.com/authentication/',
),
'qq' => array(
'name' => 'QQ帐号',
'admin_name' => 'QQ登录接口',
'class' => 'AppBundle\Component\OAuthClient\QqOAuthClient',
'icon_class' => 'qq',
'icon_img' => '',
'large_icon_img' => 'assets/img/social/qq.png',
'key_setting_label' => 'App ID',
'secret_setting_label' => 'App Key',
'apply_url' => 'http://connect.qq.com/',
),
'weixinweb' => array(
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。