<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Provider\MailSender; use ModStart\Core\Exception\BizException; class MailSenderProvider { private static $instances = array(); public static function register($oMd7I) { self::$instances[] = $oMd7I; } public static function all() { foreach (self::$instances as $kEhTf => $y2Ltn) { if ($y2Ltn instanceof \Closure) { self::$instances[$kEhTf] = call_user_func($y2Ltn); } else { if (is_string($y2Ltn)) { self::$instances[$kEhTf] = app($y2Ltn); } } } return self::$instances; } public static function get($L1N0l) { foreach (self::all() as $jIWZA) { if ($jIWZA->name() == $L1N0l) { return $jIWZA; } } BizException::throws('没有找到MailSenderProvider'); } public static function hasProvider() { $oMd7I = app()->config->get('EmailSenderProvider'); return !empty($oMd7I); } }