<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Provider; trait ProviderTrait { public static function register($RMN4M) { self::$list[] = $RMN4M; } public static function listAll() { goto bdqsz; icMiA: return self::$list; goto HY7Sm; bdqsz: static $pPTYw = false; goto II9LK; piT9d: $pPTYw = true; goto icMiA; WKrw_: foreach (self::$list as $plrwN => $uTz0e) { if ($uTz0e instanceof \Closure) { self::$list[$plrwN] = call_user_func($uTz0e); } else { if (is_string($uTz0e)) { self::$list[$plrwN] = app($uTz0e); } } if (!$sAxGo && method_exists(self::$list[$plrwN], 'order')) { $sAxGo = true; } } goto vNdXT; II9LK: if ($pPTYw) { return self::$list; } goto oESeW; oESeW: $sAxGo = false; goto WKrw_; vNdXT: if ($sAxGo) { @usort(self::$list, function ($i3XuR, $fz9U7) { if ($i3XuR->order() == $fz9U7->order()) { return 0; } return $i3XuR->order() > $fz9U7->order() ? 1 : -1; }); } goto piT9d; HY7Sm: } public static function allMap() { return array_build(self::listAll(), function ($plrwN, $uTz0e) { return array($uTz0e->name(), $uTz0e->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($plrwN, $uTz0e) { return array($uTz0e->name(), $uTz0e->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($L4owo) { foreach (self::listAll() as $ZpLX1) { if ($ZpLX1->name() == $L4owo) { return $ZpLX1; } } return null; } public static function first() { foreach (self::listAll() as $ZpLX1) { return $ZpLX1; } return null; } }