Conditions | 2 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 2 |
CRAP Score | 4.3145 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | 73 | public function boot() |
|
20 | { |
||
21 | 73 | Storage::extend('google', function ($app, $config) { |
|
22 | $client = new Google_Client; |
||
23 | |||
24 | $client->setClientId($config['clientId']); |
||
25 | $client->setClientSecret($config['clientSecret']); |
||
26 | $client->refreshToken($config['refreshToken']); |
||
27 | |||
28 | /** @var \Google\Service\Drive|\Google_Service_Drive $service */ |
||
29 | $service = new Drive($client); |
||
30 | |||
31 | $options = []; |
||
32 | |||
33 | if (isset($config['teamDriveId'])) { |
||
34 | $options['teamDriveId'] = $config['teamDriveId']; |
||
35 | } |
||
36 | |||
37 | $adapter = new GoogleDriveAdapter($service, $config['folderId'], $options); |
||
38 | |||
39 | return new Filesystem($adapter); |
||
40 | 73 | }); |
|
43 |