| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace Heanup\Library;
- use Heanup\Library\WeatherAdapt\Weather;
- class WeatherLib
- {
- private static $instance;
- public function __construct()
- {
- }
- /**
- * @param $adapter
- * @return Weather
- */
- public static function getInstance($adapter)
- {
- if (!isset(self::$instance[md5($adapter)])) {
- try{
- $class = "Heanup\\Library\\WeatherAdapt\\".$adapter . "Adapter";
- $instance = new $class();
- self::$instance[md5($adapter)] = $instance;
- }catch (\Throwable $exception){
- var_dump($exception);
- }
- }
- return self::$instance[md5($adapter)];
- }
- }
|