<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider; trait BizTrait { private static $list = array(); public static function register($X1NGK) { self::$list[] = $X1NGK; } public static function registerAll(...$AQG4G) { foreach ($AQG4G as $X1NGK) { self::register($X1NGK); } } public static function listAll() { foreach (self::$list as $ynzcc => $nfRLq) { if ($nfRLq instanceof \Closure) { self::$list[$ynzcc] = call_user_func($nfRLq); } else { if (is_string($nfRLq)) { self::$list[$ynzcc] = app($nfRLq); } } } return self::$list; } public static function getByName($TTiWe) { foreach (self::listAll() as $kHxHl) { if ($kHxHl->name() == $TTiWe) { return $kHxHl; } } return null; } public static function allMap() { return array_build(self::listAll(), function ($ynzcc, $nfRLq) { return array($nfRLq->name(), $nfRLq->title()); }); } public static function allMapEnabled() { return array_build(array_filter(self::listAll(), function ($nfRLq) { return $nfRLq->enable(); }), function ($ynzcc, $nfRLq) { return array($nfRLq->name(), $nfRLq->title()); }); } }