BaseStorage.php 848 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace crmeb\basic;
  3. /**
  4. * Class BaseStorage
  5. * @package crmeb\basic
  6. */
  7. abstract class BaseStorage
  8. {
  9. use \crmeb\traits\ErrorTrait;
  10. /**
  11. * 驱动名称
  12. * @var string
  13. */
  14. protected $name;
  15. /**
  16. * 驱动配置文件名
  17. * @var string
  18. */
  19. protected $configFile;
  20. /**
  21. * BaseStorage constructor.
  22. * @param string $name 驱动名
  23. * @param string $configFile 驱动配置名
  24. * @param array $config 其他配置
  25. */
  26. public function __construct(string $name, array $config = [], string $configFile = null)
  27. {
  28. $this->name = $name;
  29. $this->configFile = $configFile;
  30. $this->initialize($config);
  31. }
  32. /**
  33. * 初始化
  34. * @param array $config
  35. * @return mixed
  36. */
  37. abstract protected function initialize(array $config);
  38. }