<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider\SiteTemplate; class SiteTemplateProvider { private static $instances = array(DefaultSiteTemplateProvider::class); public static function register($yzKqK) { self::$instances[] = $yzKqK; } public static function all() { foreach (self::$instances as $ynzcc => $nfRLq) { if ($nfRLq instanceof \Closure) { self::$instances[$ynzcc] = call_user_func($nfRLq); } else { if (is_string($nfRLq)) { self::$instances[$ynzcc] = app($nfRLq); } } } return self::$instances; } public static function get($TTiWe) { foreach (self::all() as $yzKqK) { if ($yzKqK->name() == $TTiWe) { return $yzKqK; } } return null; } public static function map() { return array_build(self::all(), function ($ynzcc, $nfRLq) { return array($nfRLq->name(), $nfRLq->title()); }); } }