BaseStorage.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace crmeb\basic;
  12. /**
  13. * 容器基类
  14. * Class BaseStorage
  15. * @package crmeb\basic
  16. */
  17. abstract class BaseStorage
  18. {
  19. use \crmeb\traits\ErrorTrait;
  20. /**
  21. * 驱动名称
  22. * @var string
  23. */
  24. protected $name;
  25. /**
  26. * 驱动配置文件名
  27. * @var string
  28. */
  29. protected $configFile;
  30. /**
  31. * BaseStorage constructor.
  32. * @param string $name 驱动名
  33. * @param string $configFile 驱动配置名
  34. * @param array $config 其他配置
  35. */
  36. public function __construct(string $name, array $config = [], string $configFile = null)
  37. {
  38. $this->name = $name;
  39. $this->configFile = $configFile;
  40. $this->initialize($config);
  41. }
  42. /**
  43. * 初始化
  44. * @param array $config
  45. * @return mixed
  46. */
  47. abstract protected function initialize(array $config);
  48. }