Skip to content

Commit e6e2128

Browse files
Apply fixes from StyleCI (#50)
1 parent e4bf38d commit e6e2128

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

phpunit.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php
22

3-
include __DIR__.'/vendor/autoload.php';
3+
include __DIR__ . '/vendor/autoload.php';

src/GoogleStorageAdapter.php

+13-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use Google\Cloud\Storage\Bucket;
88
use Google\Cloud\Storage\StorageClient;
99
use Google\Cloud\Storage\StorageObject;
10-
use League\Flysystem\AdapterInterface;
1110
use League\Flysystem\Adapter\AbstractAdapter;
11+
use League\Flysystem\AdapterInterface;
1212
use League\Flysystem\Config;
1313
use League\Flysystem\Util;
1414

@@ -83,6 +83,7 @@ public function setStorageApiUri($uri)
8383
* Return the storage api uri.
8484
*
8585
* @param string $uri
86+
*
8687
* @return string
8788
*/
8889
public function getStorageApiUri()
@@ -130,6 +131,7 @@ public function updateStream($path, $resource, Config $config)
130131
* Returns an array of options from the config.
131132
*
132133
* @param Config $config
134+
*
133135
* @return array
134136
*/
135137
protected function getOptionsFromConfig(Config $config)
@@ -143,7 +145,7 @@ protected function getOptionsFromConfig(Config $config)
143145
// we therefore default to private
144146
$options['predefinedAcl'] = $this->getPredefinedAclForVisibility(AdapterInterface::VISIBILITY_PRIVATE);
145147
}
146-
148+
147149
if ($metadata = $config->get('metadata')) {
148150
$options['metadata'] = $metadata;
149151
}
@@ -157,6 +159,7 @@ protected function getOptionsFromConfig(Config $config)
157159
* @param string $path
158160
* @param string|resource $contents
159161
* @param Config $config
162+
*
160163
* @return array
161164
*/
162165
protected function upload($path, $contents, Config $config)
@@ -175,6 +178,7 @@ protected function upload($path, $contents, Config $config)
175178
* Returns a dictionary of object metadata from an object.
176179
*
177180
* @param StorageObject $object
181+
*
178182
* @return array
179183
*/
180184
protected function normaliseObject(StorageObject $object)
@@ -258,6 +262,7 @@ public function createDir($dirname, Config $config)
258262
* Returns a normalised directory name from the given path.
259263
*
260264
* @param string $dirname
265+
*
261266
* @return string
262267
*/
263268
protected function normaliseDirName($dirname)
@@ -274,7 +279,7 @@ public function setVisibility($path, $visibility)
274279

275280
if ($visibility === AdapterInterface::VISIBILITY_PRIVATE) {
276281
$object->acl()->delete('allUsers');
277-
} else if ($visibility === AdapterInterface::VISIBILITY_PUBLIC) {
282+
} elseif ($visibility === AdapterInterface::VISIBILITY_PUBLIC) {
278283
$object->acl()->add('allUsers', Acl::ROLE_READER);
279284
}
280285

@@ -375,7 +380,7 @@ public function getTimestamp($path)
375380
public function getVisibility($path)
376381
{
377382
return [
378-
'visibility' => $this->getRawVisibility($path)
383+
'visibility' => $this->getRawVisibility($path),
379384
];
380385
}
381386

@@ -385,6 +390,7 @@ public function getVisibility($path)
385390
* Note: The file must have `AdapterInterface::VISIBILITY_PUBLIC` visibility.
386391
*
387392
* @param string $path
393+
*
388394
* @return string
389395
*/
390396
public function getUrl($path)
@@ -396,6 +402,7 @@ public function getUrl($path)
396402

397403
/**
398404
* @param string $path
405+
*
399406
* @return string
400407
*/
401408
protected function getRawVisibility($path)
@@ -415,6 +422,7 @@ protected function getRawVisibility($path)
415422
* Returns a storage object for the given path.
416423
*
417424
* @param string $path
425+
*
418426
* @return \Google\Cloud\Storage\StorageObject
419427
*/
420428
protected function getObject($path)
@@ -425,6 +433,7 @@ protected function getObject($path)
425433

426434
/**
427435
* @param string $visibility
436+
*
428437
* @return string
429438
*/
430439
protected function getPredefinedAclForVisibility($visibility)

tests/GoogleStorageAdapterTests.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
use Psr\Http\Message\StreamInterface;
1313
use Superbalist\Flysystem\GoogleStorage\GoogleStorageAdapter;
1414

15-
class GoogleStorageTests extends \PHPUnit_Framework_TestCase
15+
class GoogleStorageAdapterTests extends \PHPUnit_Framework_TestCase
1616
{
17-
public function testGetStorageClient()
18-
{
19-
$storageClient = Mockery::mock(StorageClient::class);
17+
public function testGetStorageClient()
18+
{
19+
$storageClient = Mockery::mock(StorageClient::class);
2020
$bucket = Mockery::mock(Bucket::class);
2121
$adapter = new GoogleStorageAdapter($storageClient, $bucket);
2222

2323
$this->assertSame($storageClient, $adapter->getStorageClient());
24-
}
24+
}
2525

2626
public function testGetBucket()
2727
{
@@ -54,7 +54,7 @@ public function testWrite()
5454
[
5555
'name' => 'prefix/file1.txt',
5656
'predefinedAcl' => 'projectPrivate',
57-
]
57+
],
5858
])
5959
->once()
6060
->andReturn($storageObject);
@@ -98,7 +98,7 @@ public function testWriteWithPrivateVisibility()
9898
[
9999
'name' => 'prefix/file1.txt',
100100
'predefinedAcl' => 'projectPrivate',
101-
]
101+
],
102102
])
103103
->once()
104104
->andReturn($storageObject);
@@ -142,7 +142,7 @@ public function testWriteWithPublicVisibility()
142142
[
143143
'name' => 'prefix/file1.txt',
144144
'predefinedAcl' => 'publicRead',
145-
]
145+
],
146146
])
147147
->once()
148148
->andReturn($storageObject);
@@ -188,7 +188,7 @@ public function testWriteStream()
188188
[
189189
'name' => 'prefix/file1.txt',
190190
'predefinedAcl' => 'projectPrivate',
191-
]
191+
],
192192
])
193193
->once()
194194
->andReturn($storageObject);

0 commit comments

Comments
 (0)