<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider; trait ProviderTrait { private static $list = array(); public static function register($pXrNS) { self::$list[] = $pXrNS; } public static function listAll() { goto g1hcL; sy2Qo: if ($VlbX7) { return self::$list; } goto wPfaH; Z_4PL: $VlbX7 = true; goto hT05t; g1hcL: static $VlbX7 = false; goto sy2Qo; zL9mR: foreach (self::$list as $F4wee => $SxG_W) { if ($SxG_W instanceof \Closure) { self::$list[$F4wee] = call_user_func($SxG_W); } else { if (is_string($SxG_W)) { self::$list[$F4wee] = app($SxG_W); } } if (!$mdvWs && method_exists(self::$list[$F4wee], 'order')) { $mdvWs = true; } } goto tRhQL; wPfaH: $mdvWs = false; goto zL9mR; hT05t: return self::$list; goto jHCBP; tRhQL: if ($mdvWs) { @usort(self::$list, function ($N8dl8, $plWAb) { if ($N8dl8->order() == $plWAb->order()) { return 0; } return $N8dl8->order() > $plWAb->order() ? 1 : -1; }); } goto Z_4PL; jHCBP: } public static function allMap() { return array_build(self::listAll(), function ($F4wee, $SxG_W) { return array($SxG_W->name(), $SxG_W->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($F4wee, $SxG_W) { return array($SxG_W->name(), $SxG_W->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($fYoEH) { foreach (self::listAll() as $MNZ1i) { if ($MNZ1i->name() == $fYoEH) { return $MNZ1i; } } return null; } public static function first() { foreach (self::listAll() as $MNZ1i) { return $MNZ1i; } return null; } }