<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider; trait ProviderTrait { private static $list = array(); public static function register($tcA2a) { self::$list[] = $tcA2a; } public static function listAll() { goto aUd1D; juWOg: if ($gjumA) { @usort(self::$list, function ($xvqTK, $XRJMT) { if ($xvqTK->order() == $XRJMT->order()) { return 0; } return $xvqTK->order() > $XRJMT->order() ? 1 : -1; }); } goto M9bCY; aUd1D: static $utvYg = false; goto F5XYQ; F5XYQ: if ($utvYg) { return self::$list; } goto DTU34; M9bCY: $utvYg = true; goto ax5_l; ax5_l: return self::$list; goto vRdMT; DTU34: $gjumA = false; goto ACsj7; ACsj7: foreach (self::$list as $d2HEV => $hf0nR) { if ($hf0nR instanceof \Closure) { self::$list[$d2HEV] = call_user_func($hf0nR); } else { if (is_string($hf0nR)) { self::$list[$d2HEV] = app($hf0nR); } } if (!$gjumA && method_exists(self::$list[$d2HEV], 'order')) { $gjumA = true; } } goto juWOg; vRdMT: } public static function allMap() { return array_build(self::listAll(), function ($d2HEV, $hf0nR) { return array($hf0nR->name(), $hf0nR->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($d2HEV, $hf0nR) { return array($hf0nR->name(), $hf0nR->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($SeTC_) { foreach (self::listAll() as $zEBpl) { if ($zEBpl->name() == $SeTC_) { return $zEBpl; } } return null; } public static function first() { foreach (self::listAll() as $zEBpl) { return $zEBpl; } return null; } }