Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Commit 2f8e4ec

Browse files
Merge pull request #4 from Slayvin/bugfix-dropbox
Fixed dropbox component class
2 parents 989fe4b + cd0040f commit 2f8e4ec

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ return [
126126
Install dependency
127127

128128
```bash
129-
$ composer require league/flysystem-dropbox
129+
$ composer require spatie/flysystem-dropbox
130130
```
131131

132132
Configure on the application `components` section:
@@ -138,8 +138,7 @@ return [
138138
//...
139139
'fs' => [
140140
'class' => 'dosamigos\flysystem\DropboxFsComponent',
141-
'token' => 'your-token',
142-
'app' => 'your-app',
141+
'token' => 'your-access-token',
143142
// 'prefix' => 'your-prefix',
144143
],
145144
],

src/DropboxFsComponent.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* This file is part of the 2amigos/yii2-flysystem-component project.
45
*
@@ -7,6 +8,7 @@
78
* For the full copyright and license information, please view
89
* the LICENSE file that was distributed with this source code.
910
*/
11+
1012
namespace dosamigos\flysystem;
1113

1214
use Spatie\Dropbox\Client;
@@ -19,14 +21,11 @@ class DropboxFsComponent extends AbstractFsComponent
1921
* @var string
2022
*/
2123
public $token;
24+
2225
/**
2326
* @var string
2427
*/
25-
public $app;
26-
/**
27-
* @var string|null
28-
*/
29-
public $prefix;
28+
public $prefix = '';
3029

3130
/**
3231
* @inheritdoc
@@ -37,8 +36,8 @@ public function init()
3736
throw new InvalidConfigException('The "token" property must be set.');
3837
}
3938

40-
if ($this->app === null) {
41-
throw new InvalidConfigException('The "app" property must be set.');
39+
if (!is_string($this->prefix)) {
40+
throw new InvalidConfigException('The "prefix" property must be a string.');
4241
}
4342

4443
parent::init();
@@ -50,8 +49,7 @@ public function init()
5049
protected function initAdapter()
5150
{
5251
return new DropboxAdapter(
53-
new Client($this->token, $this->app),
54-
$this->prefix
52+
new Client($this->token), $this->prefix
5553
);
5654
}
5755
}

0 commit comments

Comments
 (0)