12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace common\modules\attachment\components\flysystem;
- use creocoder\flysystem\Filesystem;
- use yii\base\InvalidConfigException;
- class AliyuncsFilesystem extends Filesystem
- {
-
- public $access;
-
- public $secret;
-
- public $endpoint;
-
- public $isCName = false;
-
- public $bucket;
-
- public $options = [];
-
- public function init()
- {
- if ($this->access === null) {
- throw new InvalidConfigException('The "access" property must be set.');
- }
- if ($this->secret === null) {
- throw new InvalidConfigException('The "secret" property must be set.');
- }
- if ($this->endpoint === null) {
- throw new InvalidConfigException('The "endpoint" property must be set.');
- }
- if ($this->bucket === null) {
- throw new InvalidConfigException('The "bucket" property must be set.');
- }
- parent::init();
- }
-
- protected function prepareAdapter()
- {
- return new AliyuncsAdapter(
- $this->access,
- $this->secret,
- $this->endpoint,
- $this->isCName,
- $this->bucket
- );
- }
- }
|