<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider; trait ProviderTrait { private static $list = array(); public static function register($kHDkQ) { self::$list[] = $kHDkQ; } public static function listAll() { goto vE3C7; zkvkf: if ($o0weM) { return self::$list; } goto pbuAH; uOArv: $o0weM = true; goto unfeg; COPRo: if ($OCgmF) { @usort(self::$list, function ($Sg_8Z, $eH06M) { if ($Sg_8Z->order() == $eH06M->order()) { return 0; } return $Sg_8Z->order() > $eH06M->order() ? 1 : -1; }); } goto uOArv; unfeg: return self::$list; goto ESorZ; pbuAH: $OCgmF = false; goto g7J4A; g7J4A: foreach (self::$list as $D5qRP => $qGgGl) { if ($qGgGl instanceof \Closure) { self::$list[$D5qRP] = call_user_func($qGgGl); } else { if (is_string($qGgGl)) { self::$list[$D5qRP] = app($qGgGl); } } if (!$OCgmF && method_exists(self::$list[$D5qRP], 'order')) { $OCgmF = true; } } goto COPRo; vE3C7: static $o0weM = false; goto zkvkf; ESorZ: } public static function allMap() { return array_build(self::listAll(), function ($D5qRP, $qGgGl) { return array($qGgGl->name(), $qGgGl->title()); }); } public static function allDefaultMap() { return array_merge(array('' => L('None')), array_build(self::listAll(), function ($D5qRP, $qGgGl) { return array($qGgGl->name(), $qGgGl->title()); })); } public static function isEmpty() { return empty(self::$list); } public static function getByName($aVT3z) { foreach (self::listAll() as $FSL7c) { if ($FSL7c->name() == $aVT3z) { return $FSL7c; } } return null; } public static function first() { foreach (self::listAll() as $FSL7c) { return $FSL7c; } return null; } }