<?php

namespace App\Services\WeChat;

class WeChat
{


    private static $instances = [];


    private function __construct()
    {
    }

    public static function __callStatic($name, $publicId)
    {
        return self::make($name, $publicId);
    }

    private static function make($name, $publicId)
    {
        $application = "\\App\Services\WeChat\\{$name}";

        return new $application($publicId);

        // 单例模式
//        if (!isset(static::$instances[$application])) {
//            static::$instances[$application] = new $application($publicId);
//        }

//        return static::$instances[$application];
    }

    private function __clone()
    {
    }
}
