<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Provider; trait ProviderTrait { public static function register($cCkMh) { self::$list[] = $cCkMh; } public static function listAll() { goto nFZhQ; II5f7: return self::$list; goto BKHnU; nFZhQ: static $nA29B = false; goto na_lv; eL3OP: foreach (self::$list as $Fkd1C => $pk5fc) { if ($pk5fc instanceof \Closure) { self::$list[$Fkd1C] = call_user_func($pk5fc); } else { if (is_string($pk5fc)) { self::$list[$Fkd1C] = app($pk5fc); } } if (!$OjbNJ && method_exists(self::$list[$Fkd1C], 'order')) { $OjbNJ = true; } } goto TLeE3; ijsM5: $nA29B = true; goto II5f7; TLeE3: if ($OjbNJ) { @usort(self::$list, function ($pUF5h, $hYNHT) { if ($pUF5h->order() == $hYNHT->order()) { return 0; } return $pUF5h->order() > $hYNHT->order() ? 1 : -1; }); } goto ijsM5; J3EWn: $OjbNJ = false; goto eL3OP; na_lv: if ($nA29B) { return self::$list; } goto J3EWn; BKHnU: } public static function allMap() { return array_build(self::listAll(), function ($Fkd1C, $pk5fc) { return array($pk5fc->name(), $pk5fc->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($Fkd1C, $pk5fc) { return array($pk5fc->name(), $pk5fc->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($c6VKG) { foreach (self::listAll() as $yFnpO) { if ($yFnpO->name() == $c6VKG) { return $yFnpO; } } return null; } public static function first() { foreach (self::listAll() as $yFnpO) { return $yFnpO; } return null; } }