<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Provider; trait ProviderTrait { public static function register($geCFR) { self::$list[] = $geCFR; } public static function listAll() { goto aGRt1; SK3sO: if ($oLdqg) { @usort(self::$list, function ($Hi2gD, $LF0Ku) { if ($Hi2gD->order() == $LF0Ku->order()) { return 0; } return $Hi2gD->order() > $LF0Ku->order() ? 1 : -1; }); } goto blpvb; OkmQc: $oLdqg = false; goto OqFXn; Wl_Ga: return self::$list; goto cbHGz; aGRt1: static $JTH_h = false; goto UfALS; OqFXn: foreach (self::$list as $pztz4 => $Q0rz2) { if ($Q0rz2 instanceof \Closure) { self::$list[$pztz4] = call_user_func($Q0rz2); } else { if (is_string($Q0rz2)) { self::$list[$pztz4] = app($Q0rz2); } } if (!$oLdqg && method_exists(self::$list[$pztz4], 'order')) { $oLdqg = true; } } goto SK3sO; UfALS: if ($JTH_h) { return self::$list; } goto OkmQc; blpvb: $JTH_h = true; goto Wl_Ga; cbHGz: } public static function allMap() { return array_build(self::listAll(), function ($pztz4, $Q0rz2) { return array($Q0rz2->name(), $Q0rz2->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($pztz4, $Q0rz2) { return array($Q0rz2->name(), $Q0rz2->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($f0dxO) { foreach (self::listAll() as $OV1o4) { if ($OV1o4->name() == $f0dxO) { return $OV1o4; } } return null; } public static function first() { foreach (self::listAll() as $OV1o4) { return $OV1o4; } return null; } }