<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Provider; trait ProviderTrait { public static function register($reHGq) { self::$list[] = $reHGq; } public static function listAll() { goto eSyGb; ws3mS: $DyGiv = false; goto p5DvU; uNtlQ: $z4IKX = true; goto K8fPG; K2t6r: if ($z4IKX) { return self::$list; } goto ws3mS; K8fPG: return self::$list; goto hKQiJ; p5DvU: foreach (self::$list as $B34tD => $Xz28r) { if ($Xz28r instanceof \Closure) { self::$list[$B34tD] = call_user_func($Xz28r); } else { if (is_string($Xz28r)) { self::$list[$B34tD] = app($Xz28r); } } if (!$DyGiv && method_exists(self::$list[$B34tD], 'order')) { $DyGiv = true; } } goto Oo5Ej; Oo5Ej: if ($DyGiv) { @usort(self::$list, function ($K2dpg, $Qp526) { if ($K2dpg->order() == $Qp526->order()) { return 0; } return $K2dpg->order() > $Qp526->order() ? 1 : -1; }); } goto uNtlQ; eSyGb: static $z4IKX = false; goto K2t6r; hKQiJ: } public static function allMap() { return array_build(self::listAll(), function ($B34tD, $Xz28r) { return array($Xz28r->name(), $Xz28r->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($B34tD, $Xz28r) { return array($Xz28r->name(), $Xz28r->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($ZZMEd) { foreach (self::listAll() as $Esk0p) { if ($Esk0p->name() == $ZZMEd) { return $Esk0p; } } return null; } public static function first() { foreach (self::listAll() as $Esk0p) { return $Esk0p; } return null; } }