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