1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace ln\services\printer;
- use ln\basic\BaseManager;
- use think\facade\Config;
- use think\Container;
- class Printer extends BaseManager
- {
-
- protected $namespace = '\\ln\\services\\printer\\storage\\';
-
- protected $handleAccessToken;
-
- protected function getDefaultDriver()
- {
- return Config::get('printer.default', 'yi_lian_yun');
- }
-
- protected function invokeClass($class)
- {
- if (!class_exists($class)) {
- throw new \RuntimeException('class not exists: ' . $class);
- }
- $this->getConfigFile();
- if (!$this->config) {
- $this->config = Config::get($this->configFile . '.stores.' . $this->name, []);
- }
- if (!$this->handleAccessToken) {
- $this->handleAccessToken = new AccessToken($this->config, $this->name, $this->configFile);
- }
- $handle = Container::getInstance()->invokeClass($class, [$this->name, $this->handleAccessToken, $this->configFile]);
- $this->config = [];
- return $handle;
- }
- }
|