<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider; trait ProviderTrait { private static $list = array(); public static function register($yzKqK) { self::$list[] = $yzKqK; } public static function listAll() { goto nDyas; ql8y3: if ($Is04Z) { @usort(self::$list, function ($lWVLn, $qycC8) { if ($lWVLn->order() == $qycC8->order()) { return 0; } return $lWVLn->order() > $qycC8->order() ? 1 : -1; }); } goto F4LiT; hTnH6: if ($CZsw0) { return self::$list; } goto WV_Pz; F4LiT: $CZsw0 = true; goto EVbjE; WV_Pz: $Is04Z = false; goto dp3tI; dp3tI: foreach (self::$list as $ynzcc => $nfRLq) { if ($nfRLq instanceof \Closure) { self::$list[$ynzcc] = call_user_func($nfRLq); } else { if (is_string($nfRLq)) { self::$list[$ynzcc] = app($nfRLq); } } if (!$Is04Z && method_exists(self::$list[$ynzcc], 'order')) { $Is04Z = true; } } goto ql8y3; nDyas: static $CZsw0 = false; goto hTnH6; EVbjE: return self::$list; goto UKi3u; UKi3u: } public static function allMap() { return array_build(self::listAll(), function ($ynzcc, $nfRLq) { return array($nfRLq->name(), $nfRLq->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($ynzcc, $nfRLq) { return array($nfRLq->name(), $nfRLq->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($TTiWe) { foreach (self::listAll() as $kHxHl) { if ($kHxHl->name() == $TTiWe) { return $kHxHl; } } return null; } public static function first() { foreach (self::listAll() as $kHxHl) { return $kHxHl; } return null; } }