<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider; trait ProviderTrait { private static $list = array(); public static function register($O9Vtg) { self::$list[] = $O9Vtg; } public static function listAll() { goto cRVRr; vYoCv: $vCo2f = true; goto E9l1s; cRVRr: static $vCo2f = false; goto zSMEp; ASPXn: if ($dXrYD) { @usort(self::$list, function ($yFoll, $B3JG8) { if ($yFoll->order() == $B3JG8->order()) { return 0; } return $yFoll->order() > $B3JG8->order() ? 1 : -1; }); } goto vYoCv; zSMEp: if ($vCo2f) { return self::$list; } goto FTR2Y; rcC7v: foreach (self::$list as $MFVkb => $YxV2x) { if ($YxV2x instanceof \Closure) { self::$list[$MFVkb] = call_user_func($YxV2x); } else { if (is_string($YxV2x)) { self::$list[$MFVkb] = app($YxV2x); } } if (!$dXrYD && method_exists(self::$list[$MFVkb], 'order')) { $dXrYD = true; } } goto ASPXn; E9l1s: return self::$list; goto gchCG; FTR2Y: $dXrYD = false; goto rcC7v; gchCG: } public static function allMap() { return array_build(self::listAll(), function ($MFVkb, $YxV2x) { return array($YxV2x->name(), $YxV2x->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($MFVkb, $YxV2x) { return array($YxV2x->name(), $YxV2x->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($MGY9H) { foreach (self::listAll() as $Z32UA) { if ($Z32UA->name() == $MGY9H) { return $Z32UA; } } return null; } public static function first() { foreach (self::listAll() as $Z32UA) { return $Z32UA; } return null; } }