<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider; trait ProviderTrait { private static $list = array(); public static function register($ugwYT) { self::$list[] = $ugwYT; } public static function listAll() { goto us6PY; oA0u_: foreach (self::$list as $QBy8K => $cG5OI) { if ($cG5OI instanceof \Closure) { self::$list[$QBy8K] = call_user_func($cG5OI); } else { if (is_string($cG5OI)) { self::$list[$QBy8K] = app($cG5OI); } } if (!$nWhae && method_exists(self::$list[$QBy8K], 'order')) { $nWhae = true; } } goto sldIa; iLmz2: $iOo7c = true; goto ZOKd_; ZOKd_: return self::$list; goto iU8af; FrUW3: $nWhae = false; goto oA0u_; rL0Nf: if ($iOo7c) { return self::$list; } goto FrUW3; sldIa: if ($nWhae) { @usort(self::$list, function ($mHkAL, $MQMNZ) { if ($mHkAL->order() == $MQMNZ->order()) { return 0; } return $mHkAL->order() > $MQMNZ->order() ? 1 : -1; }); } goto iLmz2; us6PY: static $iOo7c = false; goto rL0Nf; iU8af: } public static function allMap() { return array_build(self::all(), function ($QBy8K, $cG5OI) { return array($cG5OI->name(), $cG5OI->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::all(), function ($QBy8K, $cG5OI) { return array($cG5OI->name(), $cG5OI->title()); })); } public static function isEmpty() { return empty(self::$list); } private static function getByName($HRrYd) { foreach (self::all() as $lDvaK) { if ($lDvaK->name() == $HRrYd) { return $lDvaK; } } return null; } }