/**
  * get storage
  *
  * @throws LaravelSmsException
  *
  * @return null
  */
 public function storage()
 {
     if (self::$storage) {
         return self::$storage;
     }
     $className = config('laravel-sms.storage', 'Toplan\\Sms\\SessionStorage');
     if (class_exists($className)) {
         self::$storage = new $className();
         return self::$storage;
     }
     throw new LaravelSmsException("Generator storage failed, don`t find class [{$className}]");
 }
Esempio n. 2
0
 /**
  * 获取存储器
  *
  * @throws LaravelSmsException
  *
  * @return Storage
  */
 protected static function storage()
 {
     if (self::$storage) {
         return self::$storage;
     }
     $className = self::getStorageClassName();
     if (!class_exists($className)) {
         throw new LaravelSmsException("Generate storage failed, the class [{$className}] does not exists.");
     }
     $store = new $className();
     if (!$store instanceof Storage) {
         throw new LaravelSmsException("Generate storage failed, the class [{$className}] does not implement the interface [Toplan\\Sms\\Storage].");
     }
     return self::$storage = $store;
 }