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