<?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($YaV4m) { self::$list[] = $YaV4m; } public static function hasEnableItems() { $XdX3D = self::get(); return !empty($XdX3D); } public static function hasItems() { goto AflvW; MIRqh: $XdX3D = array_filter($XdX3D, function ($YaV4m) { return $YaV4m->hasRender(); }); goto sB1bm; AflvW: $XdX3D = self::get(); goto MIRqh; sB1bm: return !empty($XdX3D); goto dloBN; dloBN: } public static function get($zO6V5 = null) { goto vC_Yk; qq2qP: if (null === $sT6YU) { $sT6YU = array(); foreach (self::$list as $YaV4m) { if (is_string($YaV4m)) { $YaV4m = array(app($YaV4m)); } else { if ($YaV4m instanceof \Closure) { $YaV4m = call_user_func($YaV4m); } } $sT6YU = array_merge($sT6YU, $YaV4m); } } goto D6_9K; rHWnh: foreach ($sT6YU as $YaV4m) { if ($YaV4m->name() == $zO6V5) { return $YaV4m; } } goto Mn6hd; D6_9K: if (null === $zO6V5) { return $sT6YU; } goto rHWnh; Mn6hd: return null; goto xPEsW; vC_Yk: static $sT6YU = null; goto qq2qP; xPEsW: } public static function getByOauthKey($zO6V5) { foreach (self::get() as $SRIGb) { if ($SRIGb->oauthKey() == $zO6V5) { return $SRIGb; } } return null; } public static function getOrFail($zO6V5) { goto xdfBX; xdfBX: $SRIGb = self::get($zO6V5); goto tbcvy; tbcvy: BizException::throwsIfEmpty('授权登录信息(' . $zO6V5 . ')未找到', $SRIGb); goto TsUBR; TsUBR: return $SRIGb; goto fayZj; fayZj: } private static function sort() { static $pPq0i = 1000; return $pPq0i++; } }