From f9c75260812517eaf2ea82f8af88d9f4732e7dd9 Mon Sep 17 00:00:00 2001 From: Robert Lemke Date: Thu, 15 Aug 2019 15:07:48 +0200 Subject: [PATCH] Code style changes --- Classes/GcsStorage.php | 2 +- Classes/StorageFactory.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Classes/GcsStorage.php b/Classes/GcsStorage.php index abc3f6a..c2c9df9 100644 --- a/Classes/GcsStorage.php +++ b/Classes/GcsStorage.php @@ -456,7 +456,7 @@ protected function importTemporaryFile($temporaryPathAndFilename, $collectionNam /** * @return Bucket */ - protected function getCurrentBucket() + protected function getCurrentBucket(): Bucket { if ($this->currentBucket === null) { $this->currentBucket = $this->storageClient->bucket($this->bucketName); diff --git a/Classes/StorageFactory.php b/Classes/StorageFactory.php index bb83991..ea2760c 100644 --- a/Classes/StorageFactory.php +++ b/Classes/StorageFactory.php @@ -12,6 +12,7 @@ */ use Google\Cloud\Core\ServiceBuilder; +use Google\Cloud\Storage\StorageClient; use Neos\Flow\Annotations as Flow; /** @@ -37,10 +38,10 @@ class StorageFactory * Creates a new Storage instance and authenticates against the Google API * * @param string $credentialsProfileName - * @return \Google\Cloud\Storage\StorageClient + * @return StorageClient * @throws Exception */ - public function create($credentialsProfileName = 'default') + public function create($credentialsProfileName = 'default'): StorageClient { if (!isset($this->credentialProfiles[$credentialsProfileName])) { throw new Exception(sprintf('The specified Google Cloud Storage credentials profile "%s" does not exist, please check your settings.', $credentialsProfileName), 1446553024); @@ -51,7 +52,7 @@ public function create($credentialsProfileName = 'default') 'keyFile' => json_decode(base64_decode($this->credentialProfiles[$credentialsProfileName]['credentials']['privateKeyJsonBase64Encoded']), true) ]); } else { - if (substr($this->credentialProfiles[$credentialsProfileName]['credentials']['privateKeyJsonPathAndFilename'], 0, 1) !== '/') { + if (strpos($this->credentialProfiles[$credentialsProfileName]['credentials']['privateKeyJsonPathAndFilename'], '/') !== 0) { $privateKeyPathAndFilename = FLOW_PATH_ROOT . $this->credentialProfiles[$credentialsProfileName]['credentials']['privateKeyJsonPathAndFilename']; } else { $privateKeyPathAndFilename = $this->credentialProfiles[$credentialsProfileName]['credentials']['privateKeyJsonPathAndFilename'];