<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Provider; trait ProviderTrait { public static function register($HPglu) { self::$list[] = $HPglu; } public static function listAll() { goto HXXUY; WuOTx: if ($tRRWf) { @usort(self::$list, function ($nsXTG, $YNssm) { if ($nsXTG->order() == $YNssm->order()) { return 0; } return $nsXTG->order() > $YNssm->order() ? 1 : -1; }); } goto h1drK; h1drK: $PUJfS = true; goto GDVwc; HXXUY: static $PUJfS = false; goto wDLn0; h_MHg: foreach (self::$list as $lxIPA => $knQyJ) { if ($knQyJ instanceof \Closure) { self::$list[$lxIPA] = call_user_func($knQyJ); } else { if (is_string($knQyJ)) { self::$list[$lxIPA] = app($knQyJ); } } if (!$tRRWf && method_exists(self::$list[$lxIPA], 'order')) { $tRRWf = true; } } goto WuOTx; uBmTs: $tRRWf = false; goto h_MHg; GDVwc: return self::$list; goto VRORV; wDLn0: if ($PUJfS) { return self::$list; } goto uBmTs; VRORV: } public static function allMap() { return array_build(self::listAll(), function ($lxIPA, $knQyJ) { return array($knQyJ->name(), $knQyJ->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($lxIPA, $knQyJ) { return array($knQyJ->name(), $knQyJ->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($glP3G) { foreach (self::listAll() as $P1uVJ) { if ($P1uVJ->name() == $glP3G) { return $P1uVJ; } } return null; } public static function first() { foreach (self::listAll() as $P1uVJ) { return $P1uVJ; } return null; } }