<?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($FSL7c) { self::$list[] = $FSL7c; } public static function hasEnableItems() { $WvJLs = self::get(); return !empty($WvJLs); } public static function hasItems() { goto wf8Ai; wf8Ai: $WvJLs = self::get(); goto XxMKZ; XxMKZ: $WvJLs = array_filter($WvJLs, function ($FSL7c) { return $FSL7c->hasRender(); }); goto dSml4; dSml4: return !empty($WvJLs); goto dsr23; dsr23: } public static function get($aVT3z = null) { goto nTyUW; hWTs_: if (null === $hmq1P) { $hmq1P = array(); foreach (self::$list as $FSL7c) { if (is_string($FSL7c)) { $FSL7c = array(app($FSL7c)); } else { if ($FSL7c instanceof \Closure) { $FSL7c = call_user_func($FSL7c); } } $hmq1P = array_merge($hmq1P, $FSL7c); } } goto R2Y8k; nTyUW: static $hmq1P = null; goto hWTs_; PDS8B: return null; goto VRzTh; FZyLl: foreach ($hmq1P as $FSL7c) { if ($FSL7c->name() == $aVT3z) { return $FSL7c; } } goto PDS8B; R2Y8k: if (null === $aVT3z) { return $hmq1P; } goto FZyLl; VRzTh: } public static function getByOauthKey($aVT3z) { foreach (self::get() as $i_ZUL) { if ($i_ZUL->oauthKey() == $aVT3z) { return $i_ZUL; } } return null; } public static function getOrFail($aVT3z) { goto eHy1p; eHy1p: $i_ZUL = self::get($aVT3z); goto VN8UI; VN8UI: BizException::throwsIfEmpty('授权登录信息(' . $aVT3z . ')未找到', $i_ZUL); goto joXYy; joXYy: return $i_ZUL; goto bETlL; bETlL: } private static function sort() { static $wuamL = 1000; return $wuamL++; } }