<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Config; use ModStart\Core\Exception\BizException; use Module\Member\Oauth\AbstractOauth; class MemberOauth { private static $list = array(); public static function register($jIWZA) { self::$list[] = $jIWZA; } public static function hasEnableItems() { $wKMoW = self::get(); return !empty($wKMoW); } public static function hasItems() { goto Gtd0n; Gtd0n: $wKMoW = self::get(); goto lUgCP; lUgCP: $wKMoW = array_filter($wKMoW, function ($jIWZA) { return $jIWZA->hasRender(); }); goto UI_pP; UI_pP: return !empty($wKMoW); goto tJnvP; tJnvP: } public static function get($L1N0l = null) { goto Uh4da; ZPOxs: return null; goto RVUzi; uqoG9: if (null === $K938W) { $K938W = array(); foreach (self::$list as $jIWZA) { if (is_string($jIWZA)) { $jIWZA = array(app($jIWZA)); } else { if ($jIWZA instanceof \Closure) { $jIWZA = call_user_func($jIWZA); } } $K938W = array_merge($K938W, $jIWZA); } } goto jeZPZ; U2pX7: foreach ($K938W as $jIWZA) { if ($jIWZA->name() == $L1N0l) { return $jIWZA; } } goto ZPOxs; jeZPZ: if (null === $L1N0l) { return $K938W; } goto U2pX7; Uh4da: static $K938W = null; goto uqoG9; RVUzi: } public static function getByOauthKey($L1N0l) { foreach (self::get() as $J2o_m) { if ($J2o_m->oauthKey() == $L1N0l) { return $J2o_m; } } return null; } public static function getOrFail($L1N0l) { goto CCe_L; ow16G: BizException::throwsIfEmpty('授权登录信息(' . $L1N0l . ')未找到', $J2o_m); goto AzWhL; AzWhL: return $J2o_m; goto I7A8g; CCe_L: $J2o_m = self::get($L1N0l); goto ow16G; I7A8g: } private static function sort() { static $C6vyf = 1000; return $C6vyf++; } }