1 | <?php |
||
23 | class Dropbox implements Simulator |
||
24 | { |
||
25 | use Clearable; |
||
26 | |||
27 | /** |
||
28 | * API access token |
||
29 | * |
||
30 | * Goto https://www.dropbox.com/developers/apps |
||
31 | * create your app |
||
32 | * - Dropbox api app |
||
33 | * - files and datastore |
||
34 | * - yes |
||
35 | * - provide some app name "my-dropbox-app" |
||
36 | * - generate access token to authenticate connection to your dropbox |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $token; |
||
41 | |||
42 | /** |
||
43 | * Remote path |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $path; |
||
48 | |||
49 | /** |
||
50 | * Dropbox api client |
||
51 | * |
||
52 | * @var DropboxApi |
||
53 | */ |
||
54 | protected $client; |
||
55 | |||
56 | /** |
||
57 | * (non-PHPDoc) |
||
58 | * |
||
59 | * @see \phpbu\App\Backup\Sync::setup() |
||
60 | * @param array $config |
||
61 | * @throws \phpbu\App\Backup\Sync\Exception |
||
62 | * @throws \phpbu\App\Exception |
||
63 | */ |
||
64 | 5 | public function setup(array $config) |
|
83 | |||
84 | /** |
||
85 | * (non-PHPDoc) |
||
86 | * |
||
87 | * @see \phpbu\App\Backup\Sync::sync() |
||
88 | * @param \phpbu\App\Backup\Target $target |
||
89 | * @param \phpbu\App\Result $result |
||
90 | * @throws \phpbu\App\Backup\Sync\Exception |
||
91 | */ |
||
92 | public function sync(Target $target, Result $result) |
||
109 | |||
110 | /** |
||
111 | * Simulate the sync execution. |
||
112 | * |
||
113 | * @param \phpbu\App\Backup\Target $target |
||
114 | * @param \phpbu\App\Result $result |
||
115 | */ |
||
116 | 2 | public function simulate(Target $target, Result $result) |
|
126 | |||
127 | /** |
||
128 | * Creates collector for Dropbox |
||
129 | * |
||
130 | * @param \phpbu\App\Backup\Target $target |
||
131 | * @return \phpbu\App\Backup\Collector |
||
132 | */ |
||
133 | protected function createCollector(Target $target): Collector |
||
137 | |||
138 | /** |
||
139 | * Create Dropbox api client |
||
140 | */ |
||
141 | protected function connect() |
||
146 | } |
||
147 |