Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit 4e9fb74

Browse files
Merge pull request #1 from Superbalist/analysis-qonJAg
Apply fixes from StyleCI
2 parents 257bf71 + 7dbf0ae commit 4e9fb74

File tree

6 files changed

+25
-20
lines changed

6 files changed

+25
-20
lines changed

src/Adapter/Local.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
2+
23
namespace Superbalist\Storage\Adapter;
34

45
class Local extends \League\Flysystem\Adapter\Local
56
{
6-
77
/**
88
* @var string
99
*/

src/Filesystem.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Superbalist\Storage;
34

45
use League\Flysystem\Cached\CachedAdapter;
@@ -8,10 +9,10 @@
89

910
class Filesystem extends BaseFilesystem
1011
{
11-
1212
/**
1313
* @param string $path
1414
* @param int $ttl
15+
*
1516
* @return string|null
1617
*/
1718
public function getSignedUrl($path, $ttl = 7200)
@@ -36,11 +37,11 @@ public function getSignedUrl($path, $ttl = 7200)
3637
$signer = new \Google_Signer_P12($credentials->privateKey, $credentials->privateKeyPassword);
3738
$signature = $signer->sign($raw);
3839

39-
$params = array(
40+
$params = [
4041
'GoogleAccessId' => $credentials->serviceAccountName,
4142
'Expires' => $expires,
42-
'Signature' => base64_encode($signature)
43-
);
43+
'Signature' => base64_encode($signature),
44+
];
4445
return sprintf('https://storage.googleapis.com/%s/%s?%s', $bucket, $path, http_build_query($params));
4546
} elseif ($adapter instanceof Local) {
4647
// local adapter doesn't support signed urls
@@ -53,6 +54,7 @@ public function getSignedUrl($path, $ttl = 7200)
5354

5455
/**
5556
* @param string $path
57+
*
5658
* @return string|null
5759
*/
5860
public function getPublicUrl($path)
@@ -87,6 +89,7 @@ protected function getRealAdapter()
8789

8890
/**
8991
* @param string $connection
92+
*
9093
* @return Filesystem
9194
*/
9295
public static function connection($connection)

src/GoogleAuthOAuth2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
2+
23
namespace Superbalist\Storage;
34

45
class GoogleAuthOAuth2 extends \Google_Auth_OAuth2
56
{
6-
77
/**
88
* @var \Google_Auth_AssertionCredentials
99
*/

src/StorageAdapterFactory.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Superbalist\Storage;
34

45
use Aws\S3\S3Client;
@@ -13,11 +14,12 @@
1314

1415
abstract class StorageAdapterFactory
1516
{
16-
1717
/**
1818
* @param string $name
19-
* @return \League\Flysystem\AdapterInterface
19+
*
2020
* @throws \RuntimeException
21+
*
22+
* @return \League\Flysystem\AdapterInterface
2123
*/
2224
public static function make($name)
2325
{
@@ -39,11 +41,11 @@ public static function make($name)
3941
Config::get('services.rackspace');
4042
$client = new Rackspace(
4143
$service['api_endpoint'],
42-
array(
44+
[
4345
'username' => $service['username'],
4446
'tenantName' => $service['tenant_name'],
45-
'apiKey' => $service['api_key']
46-
)
47+
'apiKey' => $service['api_key'],
48+
]
4749
);
4850
$store = $client->objectStoreService(
4951
$connection['store'],
@@ -56,14 +58,14 @@ public static function make($name)
5658
Config::get($connection['service']) :
5759
Config::get('services.aws');
5860
$client = S3Client::factory(
59-
array(
60-
'credentials' => array(
61+
[
62+
'credentials' => [
6163
'key' => $service['access_key'],
6264
'secret' => $service['secret_key'],
63-
),
65+
],
6466
'region' => $service['region'],
65-
'version' => 'latest'
66-
)
67+
'version' => 'latest',
68+
]
6769
);
6870
return new AwsS3Adapter($client, $connection['bucket']);
6971
case 'GCLOUD':
@@ -86,14 +88,14 @@ public static function make($name)
8688
$service = new \Google_Service_Storage($client);
8789

8890
return new GoogleStorageAdapter($service, $connection['bucket']);
89-
9091
}
9192

9293
throw new \RuntimeException(sprintf('The storage adapter %s is invalid.', $connection['adapter']));
9394
}
9495

9596
/**
9697
* @param string $name
98+
*
9799
* @return \League\Flysystem\AdapterInterface
98100
*/
99101
public static function makeCached($name)

src/StorageFacade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
2+
23
namespace Superbalist\Storage;
34

45
use Illuminate\Support\Facades\Facade;
56

67
class StorageFacade extends Facade
78
{
8-
99
/**
1010
* Get the registered name of the component.
1111
*

src/StorageServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
2+
23
namespace Superbalist\Storage;
34

45
use Config;
56
use Illuminate\Support\ServiceProvider;
67

78
class StorageServiceProvider extends ServiceProvider
89
{
9-
1010
/**
1111
* Register the service provider.
1212
*/
1313
public function register()
1414
{
15-
$this->app->bind('storage', function() {
15+
$this->app->bind('storage', function () {
1616
$adapter = StorageAdapterFactory::makeCached($this->app['config']->get('storage.default'));
1717
return new Filesystem($adapter);
1818
});

0 commit comments

Comments
 (0)