Passed
Push — master ( c9003b...138277 )
by xiaohui
02:15
created
src/Plugins/UploadToken.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@
 block discarded – undo
5 5
 
6 6
 class UploadToken extends AbstractPlugin
7 7
 {
8
-    public function getMethod()
9
-    {
10
-        return 'getUploadToken';
11
-    }
8
+	public function getMethod()
9
+	{
10
+		return 'getUploadToken';
11
+	}
12 12
 
13
-    public function handle($option = null)
14
-    {
15
-        return $this->filesystem->getAdapter()->getUploadToken($option);
16
-    }
13
+	public function handle($option = null)
14
+	{
15
+		return $this->filesystem->getAdapter()->getUploadToken($option);
16
+	}
17 17
 }
Please login to merge, or discard this patch.
src/Plugins/GetUrl.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
 
6 6
 class GetUrl extends AbstractPlugin
7 7
 {
8
-    public function getMethod()
9
-    {
10
-        return 'getUrl';
11
-    }
12
-    public function handle($path)
13
-    {
14
-        return $this->filesystem->getAdapter()->getUrl($path);
15
-    }
8
+	public function getMethod()
9
+	{
10
+		return 'getUrl';
11
+	}
12
+	public function handle($path)
13
+	{
14
+		return $this->filesystem->getAdapter()->getUrl($path);
15
+	}
16 16
 }
Please login to merge, or discard this patch.
src/WantuFileAdapter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@
 block discarded – undo
355 355
         return $this->client->getUploadToken(collect([
356 356
             'expiration' => Carbon::now()->addSeconds($option['ttl'])->timestamp * 1000,
357 357
             'insertOnly' => Conf::INSERT_ONLY_TRUE
358
-        ])->merge(collect($option)->except(['ttl',])));
358
+        ])->merge(collect($option)->except(['ttl', ])));
359 359
     }
360 360
 
361 361
     /**
Please login to merge, or discard this patch.
Indentation   +385 added lines, -385 removed lines patch added patch discarded remove patch
@@ -12,389 +12,389 @@
 block discarded – undo
12 12
 
13 13
 class WantuFileAdapter extends AbstractAdapter
14 14
 {
15
-    use NotSupportingVisibilityTrait;
16
-
17
-    /**
18
-     * @var Client
19
-     */
20
-    private $client;
21
-
22
-    /**
23
-     * @var string
24
-     */
25
-    private $namespace = null;
26
-
27
-    /**
28
-     * @var string
29
-     */
30
-    private $domain = null;
31
-
32
-    /**
33
-     * @param string $accessKey
34
-     * @param string $secretKey
35
-     * @param string $namespace
36
-     */
37
-    public function __construct($accessKey, $secretKey, $namespace, $origin)
38
-    {
39
-        $client = new Client($accessKey, $secretKey, $namespace);
40
-        $this->setClient($client, $namespace, $origin);
41
-    }
42
-
43
-    public function setClient(Client $client, $namespace, $origin)
44
-    {
45
-        $this->client = $client;
46
-        $this->namespace = $namespace;
47
-        $this->domain = $origin;
48
-    }
49
-
50
-    /**
51
-     * Write a new file.
52
-     *
53
-     * @param string $path
54
-     * @param string $contents
55
-     * @param Config $config   Config object
56
-     *
57
-     * @return array|false false on failure file meta data on success
58
-     */
59
-    public function write($path, $contents, Config $config)
60
-    {
61
-        $uploadPolicy = new UploadPolicy([
62
-            'namespace' => $this->namespace,
63
-            'dir' => preg_replace('/^\./', '', dirname($path)),
64
-            'name' => last(explode("/", $path)),
65
-        ]);
66
-
67
-        return $this->client->uploadData($contents, $uploadPolicy);
68
-    }
69
-
70
-    /**
71
-     * Write a new file using a stream.
72
-     *
73
-     * @param string   $path
74
-     * @param resource $resource
75
-     * @param Config   $config   Config object
76
-     *
77
-     * @return array|false false on failure file meta data on success
78
-     */
79
-    public function writeStream($path, $resource, Config $config)
80
-    {
81
-        $contents = '';
82
-
83
-        while (!feof($resource)) {
84
-            $contents .= fread($resource, 1024);
85
-        }
86
-
87
-        $response = $this->write($path, $contents, $config);
88
-
89
-        if (false === $response) {
90
-            return $response;
91
-        }
92
-
93
-        return compact('path');
94
-    }
95
-
96
-    /**
97
-     * Update a file.
98
-     *
99
-     * @param string $path
100
-     * @param string $contents
101
-     * @param Config $config   Config object
102
-     *
103
-     * @return array|false false on failure file meta data on success
104
-     */
105
-    public function update($path, $contents, Config $config)
106
-    {
107
-        $this->delete($path);
108
-
109
-        return $this->write($path, $contents, $config);
110
-    }
111
-
112
-    /**
113
-     * Update a file using a stream.
114
-     *
115
-     * @param string   $path
116
-     * @param resource $resource
117
-     * @param Config   $config   Config object
118
-     *
119
-     * @return array|false false on failure file meta data on success
120
-     */
121
-    public function updateStream($path, $resource, Config $config)
122
-    {
123
-        $this->delete($path);
124
-
125
-        return $this->writeStream($path, $resource, $config);
126
-    }
127
-
128
-    public function put($path, $contents, Config $config)
129
-    {
130
-        return $this->write($path, $contents, $config);
131
-    }
132
-
133
-    public function putStream($path, $resource, Config $config)
134
-    {
135
-        return $this->write($path, $resource, $config);
136
-    }
137
-
138
-    /**
139
-     * Rename a file.
140
-     *
141
-     * @param string $path
142
-     * @param string $newpath
143
-     *
144
-     * @return bool
145
-     */
146
-    public function rename($path, $newpath)
147
-    {
148
-        return $this->client->renameFile($this->namespace, preg_replace('/^\./', '', dirname($path)), last(explode("/", $path)), preg_replace('/^\./', '', dirname($newpath)), last(explode("/", $newpath)));
149
-    }
150
-
151
-    /**
152
-     * Copy a file.
153
-     *
154
-     * @param string $path
155
-     * @param string $newpath
156
-     *
157
-     * @return bool
158
-     */
159
-    public function copy($path, $newpath)
160
-    {
161
-    }
162
-
163
-    /**
164
-     * Delete a file.
165
-     *
166
-     * @param string $path
167
-     *
168
-     * @return bool
169
-     */
170
-    public function delete($path)
171
-    {
172
-        return $this->client->deleteFile($this->namespace, preg_replace('/^\./', '', dirname($path)), last(explode("/", $path)));
173
-    }
174
-
175
-    /**
176
-     * Delete a directory.
177
-     *
178
-     * @param string $dirname
179
-     *
180
-     * @return bool
181
-     */
182
-    public function deleteDir($dirname)
183
-    {
184
-        return $this->client->deleteDir($this->namespace, $dirname);
185
-    }
186
-
187
-    /**
188
-     * Create a directory.
189
-     *
190
-     * @param string $dirname directory name
191
-     * @param Config $config
192
-     *
193
-     * @return array|false
194
-     */
195
-    public function createDir($dirname, Config $config)
196
-    {
197
-        return $this->client->createDir($this->namespace, $dirname);
198
-    }
199
-
200
-    /**
201
-     * Check whether a file exists.
202
-     *
203
-     * @param string $path
204
-     *
205
-     * @return array|bool|null
206
-     */
207
-    public function has($path)
208
-    {
209
-        if (Str::endsWith($path, "/")) {
210
-            return $this->client->existsFolder($this->namespace, preg_replace('/^\./', '', dirname($path)));
211
-        } else {
212
-            return $this->client->existsFile($this->namespace, preg_replace('/^\./', '', dirname($path)), last(explode("/", $path)));
213
-        }
214
-    }
215
-
216
-
217
-    /**
218
-     * Read a file.
219
-     *
220
-     * @param string $path
221
-     *
222
-     * @return array|false
223
-     */
224
-    public function read($path)
225
-    {
226
-        $contents = file_get_contents($this->getUrl($path));
227
-        return compact('contents', 'path');
228
-    }
229
-
230
-    /**
231
-     * Read a file as a stream.
232
-     *
233
-     * @param string $path
234
-     *
235
-     * @return array|false
236
-     */
237
-    public function readStream($path)
238
-    {
239
-    }
240
-
241
-    /**
242
-     * List contents of a directory.
243
-     *
244
-     * @param string $directory
245
-     * @param bool   $recursive
246
-     *
247
-     * @return array
248
-     */
249
-    public function listContents($directory = '', $recursive = false)
250
-    {
251
-        return $this->client->listFiles($this->namespace, $directory, 1, 1000);
252
-    }
253
-
254
-    /**
255
-     * Get all the meta data of a file or directory.
256
-     *
257
-     * @param string $path
258
-     *
259
-     * @return array|false
260
-     */
261
-    public function getMetadata($path)
262
-    {
263
-        return $this->client->getFileInfo($this->namespace, preg_replace('/^\./', '', dirname($path)), last(explode("/", $path)));
264
-    }
265
-
266
-    /**
267
-     * Get the size of a file.
268
-     *
269
-     * @param string $path
270
-     *
271
-     * @return array|false
272
-     */
273
-    public function getSize($path)
274
-    {
275
-    }
276
-
277
-
278
-    /**
279
-     * Fetch url to bucket.
280
-     *
281
-     * @param string $path
282
-     * @param string $url
283
-     *
284
-     * @return array|false
285
-     */
286
-    public function fetch($path, $url)
287
-    {
288
-    }
289
-
290
-    /**
291
-     * Get private file download url.
292
-     *
293
-     * @param string $path
294
-     * @param int    $expires
295
-     *
296
-     * @return string
297
-     */
298
-    public function privateDownloadUrl($path, $expires = 3600)
299
-    {
300
-    }
301
-
302
-    /**
303
-     * Refresh file cache.
304
-     *
305
-     * @param string|array $path
306
-     *
307
-     * @return array
308
-     */
309
-    public function refresh($path)
310
-    {
311
-    }
312
-
313
-
314
-    /**
315
-     * Get the mime-type of a file.
316
-     *
317
-     * @param string $path
318
-     *
319
-     * @return array|false
320
-     */
321
-    public function getMimeType($path)
322
-    {
323
-    }
324
-
325
-
326
-    /**
327
-     * Get the timestamp of a file.
328
-     *
329
-     * @param string $path
330
-     *
331
-     * @return array|false
332
-     */
333
-    public function getTimestamp($path)
334
-    {
335
-    }
336
-
337
-    /**
338
-     * Get the upload token.
339
-     *
340
-     * @param string|null $key
341
-     * @param int         $ttl
342
-     * @param string|null $policy
343
-     * @param string|null $strictPolice
344
-     *
345
-     * @return string
346
-     */
347
-    public function getUploadToken($option = null)
348
-    {
349
-        if ($option === null) {
350
-            $option = ['name' => null, 'ttl' => 3600, ];
351
-        } elseif (!isset($option['ttl']) || !$option['ttl']) {
352
-            $option['ttl'] = 3600;
353
-        }
354
-
355
-        return $this->client->getUploadToken(collect([
356
-            'expiration' => Carbon::now()->addSeconds($option['ttl'])->timestamp * 1000,
357
-            'insertOnly' => Conf::INSERT_ONLY_TRUE
358
-        ])->merge(collect($option)->except(['ttl',])));
359
-    }
360
-
361
-    /**
362
-     * @param array $stats
363
-     *
364
-     * @return array
365
-     */
366
-    protected function normalizeFileInfo(array $stats)
367
-    {
368
-        return [
369
-            'type' => 'file',
370
-            'path' => $stats['key'],
371
-            'timestamp' => floor($stats['putTime'] / 10000000),
372
-            'size' => $stats['fsize'],
373
-        ];
374
-    }
375
-
376
-    /**
377
-     * Get resource url.
378
-     *
379
-     * @param string $path
380
-     *
381
-     * @return string
382
-     */
383
-    public function getUrl($path)
384
-    {
385
-        return $this->normalizeHost($this->domain) . ltrim($path, '/');
386
-    }
387
-
388
-    /**
389
-     * @param string $domain
390
-     *
391
-     * @return string
392
-     */
393
-    protected function normalizeHost($domain)
394
-    {
395
-        if (0 !== stripos($domain, 'https://') && 0 !== stripos($domain, 'http://')) {
396
-            $domain = "http://{$domain}";
397
-        }
398
-        return rtrim($domain, '/') . '/';
399
-    }
15
+	use NotSupportingVisibilityTrait;
16
+
17
+	/**
18
+	 * @var Client
19
+	 */
20
+	private $client;
21
+
22
+	/**
23
+	 * @var string
24
+	 */
25
+	private $namespace = null;
26
+
27
+	/**
28
+	 * @var string
29
+	 */
30
+	private $domain = null;
31
+
32
+	/**
33
+	 * @param string $accessKey
34
+	 * @param string $secretKey
35
+	 * @param string $namespace
36
+	 */
37
+	public function __construct($accessKey, $secretKey, $namespace, $origin)
38
+	{
39
+		$client = new Client($accessKey, $secretKey, $namespace);
40
+		$this->setClient($client, $namespace, $origin);
41
+	}
42
+
43
+	public function setClient(Client $client, $namespace, $origin)
44
+	{
45
+		$this->client = $client;
46
+		$this->namespace = $namespace;
47
+		$this->domain = $origin;
48
+	}
49
+
50
+	/**
51
+	 * Write a new file.
52
+	 *
53
+	 * @param string $path
54
+	 * @param string $contents
55
+	 * @param Config $config   Config object
56
+	 *
57
+	 * @return array|false false on failure file meta data on success
58
+	 */
59
+	public function write($path, $contents, Config $config)
60
+	{
61
+		$uploadPolicy = new UploadPolicy([
62
+			'namespace' => $this->namespace,
63
+			'dir' => preg_replace('/^\./', '', dirname($path)),
64
+			'name' => last(explode("/", $path)),
65
+		]);
66
+
67
+		return $this->client->uploadData($contents, $uploadPolicy);
68
+	}
69
+
70
+	/**
71
+	 * Write a new file using a stream.
72
+	 *
73
+	 * @param string   $path
74
+	 * @param resource $resource
75
+	 * @param Config   $config   Config object
76
+	 *
77
+	 * @return array|false false on failure file meta data on success
78
+	 */
79
+	public function writeStream($path, $resource, Config $config)
80
+	{
81
+		$contents = '';
82
+
83
+		while (!feof($resource)) {
84
+			$contents .= fread($resource, 1024);
85
+		}
86
+
87
+		$response = $this->write($path, $contents, $config);
88
+
89
+		if (false === $response) {
90
+			return $response;
91
+		}
92
+
93
+		return compact('path');
94
+	}
95
+
96
+	/**
97
+	 * Update a file.
98
+	 *
99
+	 * @param string $path
100
+	 * @param string $contents
101
+	 * @param Config $config   Config object
102
+	 *
103
+	 * @return array|false false on failure file meta data on success
104
+	 */
105
+	public function update($path, $contents, Config $config)
106
+	{
107
+		$this->delete($path);
108
+
109
+		return $this->write($path, $contents, $config);
110
+	}
111
+
112
+	/**
113
+	 * Update a file using a stream.
114
+	 *
115
+	 * @param string   $path
116
+	 * @param resource $resource
117
+	 * @param Config   $config   Config object
118
+	 *
119
+	 * @return array|false false on failure file meta data on success
120
+	 */
121
+	public function updateStream($path, $resource, Config $config)
122
+	{
123
+		$this->delete($path);
124
+
125
+		return $this->writeStream($path, $resource, $config);
126
+	}
127
+
128
+	public function put($path, $contents, Config $config)
129
+	{
130
+		return $this->write($path, $contents, $config);
131
+	}
132
+
133
+	public function putStream($path, $resource, Config $config)
134
+	{
135
+		return $this->write($path, $resource, $config);
136
+	}
137
+
138
+	/**
139
+	 * Rename a file.
140
+	 *
141
+	 * @param string $path
142
+	 * @param string $newpath
143
+	 *
144
+	 * @return bool
145
+	 */
146
+	public function rename($path, $newpath)
147
+	{
148
+		return $this->client->renameFile($this->namespace, preg_replace('/^\./', '', dirname($path)), last(explode("/", $path)), preg_replace('/^\./', '', dirname($newpath)), last(explode("/", $newpath)));
149
+	}
150
+
151
+	/**
152
+	 * Copy a file.
153
+	 *
154
+	 * @param string $path
155
+	 * @param string $newpath
156
+	 *
157
+	 * @return bool
158
+	 */
159
+	public function copy($path, $newpath)
160
+	{
161
+	}
162
+
163
+	/**
164
+	 * Delete a file.
165
+	 *
166
+	 * @param string $path
167
+	 *
168
+	 * @return bool
169
+	 */
170
+	public function delete($path)
171
+	{
172
+		return $this->client->deleteFile($this->namespace, preg_replace('/^\./', '', dirname($path)), last(explode("/", $path)));
173
+	}
174
+
175
+	/**
176
+	 * Delete a directory.
177
+	 *
178
+	 * @param string $dirname
179
+	 *
180
+	 * @return bool
181
+	 */
182
+	public function deleteDir($dirname)
183
+	{
184
+		return $this->client->deleteDir($this->namespace, $dirname);
185
+	}
186
+
187
+	/**
188
+	 * Create a directory.
189
+	 *
190
+	 * @param string $dirname directory name
191
+	 * @param Config $config
192
+	 *
193
+	 * @return array|false
194
+	 */
195
+	public function createDir($dirname, Config $config)
196
+	{
197
+		return $this->client->createDir($this->namespace, $dirname);
198
+	}
199
+
200
+	/**
201
+	 * Check whether a file exists.
202
+	 *
203
+	 * @param string $path
204
+	 *
205
+	 * @return array|bool|null
206
+	 */
207
+	public function has($path)
208
+	{
209
+		if (Str::endsWith($path, "/")) {
210
+			return $this->client->existsFolder($this->namespace, preg_replace('/^\./', '', dirname($path)));
211
+		} else {
212
+			return $this->client->existsFile($this->namespace, preg_replace('/^\./', '', dirname($path)), last(explode("/", $path)));
213
+		}
214
+	}
215
+
216
+
217
+	/**
218
+	 * Read a file.
219
+	 *
220
+	 * @param string $path
221
+	 *
222
+	 * @return array|false
223
+	 */
224
+	public function read($path)
225
+	{
226
+		$contents = file_get_contents($this->getUrl($path));
227
+		return compact('contents', 'path');
228
+	}
229
+
230
+	/**
231
+	 * Read a file as a stream.
232
+	 *
233
+	 * @param string $path
234
+	 *
235
+	 * @return array|false
236
+	 */
237
+	public function readStream($path)
238
+	{
239
+	}
240
+
241
+	/**
242
+	 * List contents of a directory.
243
+	 *
244
+	 * @param string $directory
245
+	 * @param bool   $recursive
246
+	 *
247
+	 * @return array
248
+	 */
249
+	public function listContents($directory = '', $recursive = false)
250
+	{
251
+		return $this->client->listFiles($this->namespace, $directory, 1, 1000);
252
+	}
253
+
254
+	/**
255
+	 * Get all the meta data of a file or directory.
256
+	 *
257
+	 * @param string $path
258
+	 *
259
+	 * @return array|false
260
+	 */
261
+	public function getMetadata($path)
262
+	{
263
+		return $this->client->getFileInfo($this->namespace, preg_replace('/^\./', '', dirname($path)), last(explode("/", $path)));
264
+	}
265
+
266
+	/**
267
+	 * Get the size of a file.
268
+	 *
269
+	 * @param string $path
270
+	 *
271
+	 * @return array|false
272
+	 */
273
+	public function getSize($path)
274
+	{
275
+	}
276
+
277
+
278
+	/**
279
+	 * Fetch url to bucket.
280
+	 *
281
+	 * @param string $path
282
+	 * @param string $url
283
+	 *
284
+	 * @return array|false
285
+	 */
286
+	public function fetch($path, $url)
287
+	{
288
+	}
289
+
290
+	/**
291
+	 * Get private file download url.
292
+	 *
293
+	 * @param string $path
294
+	 * @param int    $expires
295
+	 *
296
+	 * @return string
297
+	 */
298
+	public function privateDownloadUrl($path, $expires = 3600)
299
+	{
300
+	}
301
+
302
+	/**
303
+	 * Refresh file cache.
304
+	 *
305
+	 * @param string|array $path
306
+	 *
307
+	 * @return array
308
+	 */
309
+	public function refresh($path)
310
+	{
311
+	}
312
+
313
+
314
+	/**
315
+	 * Get the mime-type of a file.
316
+	 *
317
+	 * @param string $path
318
+	 *
319
+	 * @return array|false
320
+	 */
321
+	public function getMimeType($path)
322
+	{
323
+	}
324
+
325
+
326
+	/**
327
+	 * Get the timestamp of a file.
328
+	 *
329
+	 * @param string $path
330
+	 *
331
+	 * @return array|false
332
+	 */
333
+	public function getTimestamp($path)
334
+	{
335
+	}
336
+
337
+	/**
338
+	 * Get the upload token.
339
+	 *
340
+	 * @param string|null $key
341
+	 * @param int         $ttl
342
+	 * @param string|null $policy
343
+	 * @param string|null $strictPolice
344
+	 *
345
+	 * @return string
346
+	 */
347
+	public function getUploadToken($option = null)
348
+	{
349
+		if ($option === null) {
350
+			$option = ['name' => null, 'ttl' => 3600, ];
351
+		} elseif (!isset($option['ttl']) || !$option['ttl']) {
352
+			$option['ttl'] = 3600;
353
+		}
354
+
355
+		return $this->client->getUploadToken(collect([
356
+			'expiration' => Carbon::now()->addSeconds($option['ttl'])->timestamp * 1000,
357
+			'insertOnly' => Conf::INSERT_ONLY_TRUE
358
+		])->merge(collect($option)->except(['ttl',])));
359
+	}
360
+
361
+	/**
362
+	 * @param array $stats
363
+	 *
364
+	 * @return array
365
+	 */
366
+	protected function normalizeFileInfo(array $stats)
367
+	{
368
+		return [
369
+			'type' => 'file',
370
+			'path' => $stats['key'],
371
+			'timestamp' => floor($stats['putTime'] / 10000000),
372
+			'size' => $stats['fsize'],
373
+		];
374
+	}
375
+
376
+	/**
377
+	 * Get resource url.
378
+	 *
379
+	 * @param string $path
380
+	 *
381
+	 * @return string
382
+	 */
383
+	public function getUrl($path)
384
+	{
385
+		return $this->normalizeHost($this->domain) . ltrim($path, '/');
386
+	}
387
+
388
+	/**
389
+	 * @param string $domain
390
+	 *
391
+	 * @return string
392
+	 */
393
+	protected function normalizeHost($domain)
394
+	{
395
+		if (0 !== stripos($domain, 'https://') && 0 !== stripos($domain, 'http://')) {
396
+			$domain = "http://{$domain}";
397
+		}
398
+		return rtrim($domain, '/') . '/';
399
+	}
400 400
 }
Please login to merge, or discard this patch.
src/WantuFileServiceProvider.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
10 10
 
11 11
 class WantuFileServiceProvider extends ServiceProvider
12 12
 {
13
-    public function register()
14
-    {
15
-        app('filesystem')->extend('wantu', function ($app, $config) {
16
-            $adapter = new WantuFileAdapter(
17
-                $config['access_key'],
18
-                $config['secret_key'],
19
-                $config['namespace'],
20
-                $config['domain']
21
-            );
22
-            $flysystem = new Filesystem($adapter, new Config(['disable_asserts' => true]));
23
-            // $flysystem->addPlugin(new FetchFile());
24
-            $flysystem->addPlugin(new UploadToken());
25
-            $flysystem->addPlugin(new GetUrl());
26
-            // $flysystem->addPlugin(new PrivateDownloadUrl());
27
-            // $flysystem->addPlugin(new RefreshFile());
28
-            return $flysystem;
29
-        });
30
-    }
13
+	public function register()
14
+	{
15
+		app('filesystem')->extend('wantu', function ($app, $config) {
16
+			$adapter = new WantuFileAdapter(
17
+				$config['access_key'],
18
+				$config['secret_key'],
19
+				$config['namespace'],
20
+				$config['domain']
21
+			);
22
+			$flysystem = new Filesystem($adapter, new Config(['disable_asserts' => true]));
23
+			// $flysystem->addPlugin(new FetchFile());
24
+			$flysystem->addPlugin(new UploadToken());
25
+			$flysystem->addPlugin(new GetUrl());
26
+			// $flysystem->addPlugin(new PrivateDownloadUrl());
27
+			// $flysystem->addPlugin(new RefreshFile());
28
+			return $flysystem;
29
+		});
30
+	}
31 31
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 {
13 13
     public function register()
14 14
     {
15
-        app('filesystem')->extend('wantu', function ($app, $config) {
15
+        app('filesystem')->extend('wantu', function($app, $config) {
16 16
             $adapter = new WantuFileAdapter(
17 17
                 $config['access_key'],
18 18
                 $config['secret_key'],
Please login to merge, or discard this patch.
scripts/mergeRequireDev.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 $opt = stream_context_create([
3
-    'http' => [
4
-        'method' => "GET",
5
-        'header' => "Accept-language: en\r\n" .
6
-            "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36\r\n" .
7
-            "Authorization: token " . getenv('GITHUB_TOKEN') . "\r\n"
8
-    ],
3
+	'http' => [
4
+		'method' => "GET",
5
+		'header' => "Accept-language: en\r\n" .
6
+			"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36\r\n" .
7
+			"Authorization: token " . getenv('GITHUB_TOKEN') . "\r\n"
8
+	],
9 9
 ]);
10 10
 
11 11
 $latestLaravelVerContent = file_get_contents('https://api.github.com/repos/xiaohuilam/laravel-wxapp-login/issues/10', false, $opt);
12 12
 $json = json_decode($latestLaravelVerContent);
13 13
 
14 14
 if (json_last_error() !== JSON_ERROR_NONE || !$latestLaravelVerContent || !$json || !isset($json->body)) {
15
-    exit(1);
15
+	exit(1);
16 16
 }
17 17
 
18 18
 $ver = $json->body;
Please login to merge, or discard this patch.
tests/FilesystemTest.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 
8 8
 class FilesystemTest extends AbstractTest
9 9
 {
10
-    /**
11
-     * 测试登陆
12
-     *
13
-     * @return void
14
-     */
15
-    public function testRegisterProvider()
16
-    {
17
-        /**
18
-         * @var \Illuminate\Filesystem\FilesystemAdapter $disk
19
-         */
20
-        $disk = Storage::disk('wantu');
21
-        $this->assertEquals(WantuFileAdapter::class, get_class($disk->getDriver()->getAdapter()));
22
-    }
10
+	/**
11
+	 * 测试登陆
12
+	 *
13
+	 * @return void
14
+	 */
15
+	public function testRegisterProvider()
16
+	{
17
+		/**
18
+		 * @var \Illuminate\Filesystem\FilesystemAdapter $disk
19
+		 */
20
+		$disk = Storage::disk('wantu');
21
+		$this->assertEquals(WantuFileAdapter::class, get_class($disk->getDriver()->getAdapter()));
22
+	}
23 23
 }
Please login to merge, or discard this patch.
tests/AbstractTest/AbstractTest.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -10,33 +10,33 @@
 block discarded – undo
10 10
  */
11 11
 abstract class AbstractTest extends TestCase
12 12
 {
13
-    /**
14
-     * Creates the application.
15
-     *
16
-     * @return \Illuminate\Foundation\Application
17
-     */
18
-    public function createApplication()
19
-    {
20
-        /**
21
-         * @var \Illuminate\Foundation\Application $app
22
-         */
23
-        $app = require __DIR__ . '/../../vendor/laravel/laravel/bootstrap/app.php';
13
+	/**
14
+	 * Creates the application.
15
+	 *
16
+	 * @return \Illuminate\Foundation\Application
17
+	 */
18
+	public function createApplication()
19
+	{
20
+		/**
21
+		 * @var \Illuminate\Foundation\Application $app
22
+		 */
23
+		$app = require __DIR__ . '/../../vendor/laravel/laravel/bootstrap/app.php';
24 24
 
25
-        $app->make(Kernel::class)->bootstrap();
25
+		$app->make(Kernel::class)->bootstrap();
26 26
 
27
-        config()->set('app.env', 'testing');
28
-        config()->set('app.debug', true);
29
-        config()->set('app.key', 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF');
30
-        config()->set('filesystems.disks.wantu', [
31
-            'driver' => 'wantu',
32
-            'access_key' => 'test',
33
-            'secret_key' => 'test',
34
-            'namespace' => 'test',
35
-            'domain' => 'test',
36
-        ]);
27
+		config()->set('app.env', 'testing');
28
+		config()->set('app.debug', true);
29
+		config()->set('app.key', 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF');
30
+		config()->set('filesystems.disks.wantu', [
31
+			'driver' => 'wantu',
32
+			'access_key' => 'test',
33
+			'secret_key' => 'test',
34
+			'namespace' => 'test',
35
+			'domain' => 'test',
36
+		]);
37 37
 
38
-        $app->register(WantuFileServiceProvider::class);
38
+		$app->register(WantuFileServiceProvider::class);
39 39
 
40
-        return $app;
41
-    }
40
+		return $app;
41
+	}
42 42
 }
Please login to merge, or discard this patch.