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

Commit 4c112eb

Browse files
authored
Fix issue #57: array merge with null (#59)
* Fix issue #57: array merge with null * Space after !
1 parent 81da22a commit 4c112eb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/GoogleCloudStorageServiceProvider.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,20 @@ public function boot()
8484
*/
8585
private function createClient($config)
8686
{
87-
if (is_string(array_get($config, 'key_file'))) {
87+
$keyFile = array_get($config, 'key_file');
88+
if (is_string($keyFile)) {
8889
return new StorageClient([
8990
'projectId' => $config['project_id'],
90-
'keyFilePath' => array_get($config, 'key_file'),
91+
'keyFilePath' => $keyFile,
9192
]);
9293
}
9394

95+
if (! is_array($keyFile)) {
96+
$keyFile = [];
97+
}
9498
return new StorageClient([
9599
'projectId' => $config['project_id'],
96-
'keyFile' => array_merge([
97-
"project_id" => $config['project_id']
98-
], array_get($config, 'key_file', []))
100+
'keyFile' => array_merge(["project_id" => $config['project_id']], $keyFile)
99101
]);
100102
}
101103

0 commit comments

Comments
 (0)