Test Failed
Branch master (3a0aa4)
by Domenico
03:45
created
src/Commands/Handlers/HasFolder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function handle(array $params = []): bool
32 32
     {
33
-        $bucketName = $params[ 'bucket' ];
34
-        $prefix     = $params[ 'prefix' ];
33
+        $bucketName = $params['bucket'];
34
+        $prefix     = $params['prefix'];
35 35
 
36 36
         if ($this->client->hasEncoder()) {
37 37
             $prefix = $this->client->getEncoder()->encode($prefix);
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
     public function validateParams(array $params = []): bool
57 57
     {
58 58
         return (
59
-                isset($params[ 'bucket' ]) and
60
-                isset($params[ 'prefix' ])
59
+                isset($params['bucket']) and
60
+                isset($params['prefix'])
61 61
         );
62 62
     }
63 63
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         try {
82 82
             $result = $this->client->getConn()->execute($command);
83 83
 
84
-            return $result[ 'Contents' ] || $result[ 'CommonPrefixes' ];
84
+            return $result['Contents'] || $result['CommonPrefixes'];
85 85
         } catch (S3Exception $e) {
86 86
             $this->commandHandlerLogger?->logExceptionAndReturnFalse($e);
87 87
 
Please login to merge, or discard this patch.
src/Commands/Handlers/SetBucketPolicy.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,26 +29,26 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function handle(array $params = []): bool
31 31
     {
32
-        $bucketName = $params[ 'bucket' ];
33
-        $policy     = $params[ 'policy' ];
32
+        $bucketName = $params['bucket'];
33
+        $policy     = $params['policy'];
34 34
 
35 35
         $config = [
36 36
                 'Bucket' => $bucketName,
37 37
                 'Policy' => $policy,
38 38
         ];
39 39
 
40
-        if (isset($params[ 'access' ])) {
41
-            $config[ 'ConfirmRemoveSelfBucketAccess' ] = $params[ 'access' ];
40
+        if (isset($params['access'])) {
41
+            $config['ConfirmRemoveSelfBucketAccess'] = $params['access'];
42 42
         }
43 43
 
44
-        if (isset($params[ 'md5' ])) {
45
-            $config[ 'ContentMD5' ] = $params[ 'md5' ];
44
+        if (isset($params['md5'])) {
45
+            $config['ContentMD5'] = $params['md5'];
46 46
         }
47 47
 
48 48
         try {
49 49
             $policy = $this->client->getConn()->putBucketPolicy($config);
50 50
 
51
-            if (($policy instanceof ResultInterface) and $policy[ '@metadata' ][ 'statusCode' ] === 204) {
51
+            if (($policy instanceof ResultInterface) and $policy['@metadata']['statusCode'] === 204) {
52 52
                 $this->commandHandlerLogger?->log($this, sprintf('Policy was successfully set for bucket \'%s\'', $bucketName));
53 53
 
54 54
                 return true;
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
     public function validateParams(array $params = []): bool
73 73
     {
74 74
         return (
75
-                isset($params[ 'bucket' ]) and
76
-                isset($params[ 'policy' ])
75
+                isset($params['bucket']) and
76
+                isset($params['policy'])
77 77
         );
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
src/Commands/Handlers/OpenItem.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function handle(array $params = []): ?string
29 29
     {
30
-        $bucketName = $params[ 'bucket' ];
31
-        $keyName    = $params[ 'key' ];
30
+        $bucketName = $params['bucket'];
31
+        $keyName    = $params['key'];
32 32
 
33 33
         try {
34 34
             $url     = $this->client->getPublicItemLink(['bucket' => $bucketName, 'key' => $keyName]);
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
     public function validateParams(array $params = []): bool
59 59
     {
60 60
         return (
61
-                isset($params[ 'bucket' ]) and
62
-                isset($params[ 'key' ])
61
+                isset($params['bucket']) and
62
+                isset($params['key'])
63 63
         );
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
src/Commands/Handlers/CopyItem.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function handle(array $params = []): bool
32 32
     {
33
-        $targetBucketName = $params[ 'target_bucket' ];
34
-        $targetKeyname    = $params[ 'target' ];
35
-        $sourceBucket     = $params[ 'source_bucket' ];
36
-        $sourceKeyname    = $params[ 'source' ];
33
+        $targetBucketName = $params['target_bucket'];
34
+        $targetKeyname    = $params['target'];
35
+        $sourceBucket     = $params['source_bucket'];
36
+        $sourceKeyname    = $params['source'];
37 37
 
38 38
         $this->client->createBucketIfItDoesNotExist(['bucket' => $targetBucketName]);
39 39
 
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
             ];
53 53
 
54 54
             if ($this->client->isBucketVersioned(['bucket' => $sourceBucket])) {
55
-                $version                = $this->client->getCurrentItemVersion(['bucket' => $sourceBucket, 'key' => $params[ 'source' ]]);
56
-                $config[ 'CopySource' ] = $copySource . '?versionId=' . $version;
55
+                $version                = $this->client->getCurrentItemVersion(['bucket' => $sourceBucket, 'key' => $params['source']]);
56
+                $config['CopySource'] = $copySource . '?versionId=' . $version;
57 57
             }
58 58
 
59 59
             $copied = $this->client->getConn()->copyObject($config);
60 60
 
61
-            if (($copied instanceof ResultInterface) and $copied[ '@metadata' ][ 'statusCode' ] === 200) {
61
+            if (($copied instanceof ResultInterface) and $copied['@metadata']['statusCode'] === 200) {
62 62
                 $this->commandHandlerLogger?->log($this, sprintf('File \'%s/%s\' was successfully copied to \'%s/%s\'', $sourceBucket, $sourceKeyname, $targetBucketName, $targetKeyname));
63 63
 
64 64
                 if ($this->client->hasCache()) {
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
     public function validateParams(array $params = []): bool
87 87
     {
88 88
         return (
89
-                isset($params[ 'target_bucket' ]) and
90
-                isset($params[ 'target' ]) and
91
-                isset($params[ 'source_bucket' ]) and
92
-                isset($params[ 'source' ])
89
+                isset($params['target_bucket']) and
90
+                isset($params['target']) and
91
+                isset($params['source_bucket']) and
92
+                isset($params['source'])
93 93
         );
94 94
     }
95 95
 
Please login to merge, or discard this patch.
src/Commands/Handlers/CreateFolder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function handle(array $params = []): bool
33 33
     {
34
-        $bucketName = $params[ 'bucket' ];
35
-        $keyName    = $params[ 'key' ];
34
+        $bucketName = $params['bucket'];
35
+        $keyName    = $params['key'];
36 36
 
37 37
         if ($this->client->hasEncoder()) {
38 38
             $keyName = $this->client->getEncoder()->encode($keyName);
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 //                'ACL'    => 'public-read' // only bucket owners are allowed to create folder with ACL or bucket owner enforcement must be disabled
51 51
             ]);
52 52
 
53
-            if (($folder instanceof ResultInterface) and $folder[ '@metadata' ][ 'statusCode' ] === 200) {
53
+            if (($folder instanceof ResultInterface) and $folder['@metadata']['statusCode'] === 200) {
54 54
                 $this->commandHandlerLogger?->log($this, sprintf('Folder \'%s\' was successfully created in \'%s\' bucket', $keyName, $bucketName));
55 55
 
56 56
                 return true;
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
     public function validateParams(array $params = []): bool
75 75
     {
76 76
         return (
77
-                isset($params[ 'bucket' ]) and
78
-                isset($params[ 'key' ])
77
+                isset($params['bucket']) and
78
+                isset($params['key'])
79 79
         );
80 80
     }
81 81
 }
Please login to merge, or discard this patch.
src/Commands/Handlers/ClearBucket.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function handle(array $params = ['bucket' => 'no-bucket-provided']): bool
28 28
     {
29
-        $bucketName = $params[ 'bucket' ];
29
+        $bucketName = $params['bucket'];
30 30
         $errors     = [];
31 31
 
32 32
         if (false === $this->client->hasBucket(['bucket' => $bucketName])) {
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
             $version = null;
46 46
             if (str_contains($key, '<VERSION_ID:')) {
47 47
                 $v       = explode('<VERSION_ID:', $key);
48
-                $version = str_replace('>', '', $v[ 1 ]);
49
-                $key     = $v[ 0 ];
48
+                $version = str_replace('>', '', $v[1]);
49
+                $key     = $v[0];
50 50
             }
51 51
 
52 52
             if (false === $delete = $this->client->deleteItem(['bucket' => $bucketName, 'key' => $key, 'version' => $version])) {
@@ -72,6 +72,6 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function validateParams(array $params = []): bool
74 74
     {
75
-        return isset($params[ 'bucket' ]);
75
+        return isset($params['bucket']);
76 76
     }
77 77
 }
Please login to merge, or discard this patch.
src/Commands/Handlers/Transfer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function handle(array $params = []): bool
27 27
     {
28
-        $dest    = $params[ 'dest' ];
29
-        $source  = $params[ 'source' ];
30
-        $options = (isset($params[ 'options' ])) ? $params[ 'options' ] : [];
28
+        $dest    = $params['dest'];
29
+        $source  = $params['source'];
30
+        $options = (isset($params['options'])) ? $params['options'] : [];
31 31
 
32 32
         return $this->transfer($dest, $source, $options);
33 33
     }
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
     public function validateParams(array $params = []): bool
41 41
     {
42 42
         return (
43
-                isset($params[ 'dest' ]) and
44
-                isset($params[ 'source' ])
43
+                isset($params['dest']) and
44
+                isset($params['source'])
45 45
         );
46 46
     }
47 47
 
Please login to merge, or discard this patch.
src/Commands/Handlers/UploadItemFromBody.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function handle(array $params = []): bool
37 37
     {
38
-        $bucketName = $params[ 'bucket' ];
39
-        $keyName    = $params[ 'key' ];
40
-        $body       = $params[ 'body' ];
38
+        $bucketName = $params['bucket'];
39
+        $keyName    = $params['key'];
40
+        $body       = $params['body'];
41 41
 
42
-        if (isset($params[ 'bucket_check' ]) and true === $params[ 'bucket_check' ]) {
42
+        if (isset($params['bucket_check']) and true === $params['bucket_check']) {
43 43
             $this->client->createBucketIfItDoesNotExist(['bucket' => $bucketName]);
44 44
         }
45 45
 
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
             throw new InvalidS3NameException(sprintf('%s is not a valid S3 object name. [' . implode(', ', S3ObjectSafeNameValidator::validate($keyName)) . ']', $keyName));
48 48
         }
49 49
 
50
-        if ((isset($params[ 'storage' ]) and false === S3StorageClassNameValidator::isValid($params[ 'storage' ]))) {
51
-            throw new InvalidArgumentException(S3StorageClassNameValidator::validate($params[ 'storage' ])[ 0 ]);
50
+        if ((isset($params['storage']) and false === S3StorageClassNameValidator::isValid($params['storage']))) {
51
+            throw new InvalidArgumentException(S3StorageClassNameValidator::validate($params['storage'])[0]);
52 52
         }
53 53
 
54 54
         if ($this->client->hasEncoder()) {
55 55
             $keyName = $this->client->getEncoder()->encode($keyName);
56 56
         }
57 57
 
58
-        return $this->upload($bucketName, $keyName, $body, (isset($params[ 'storage' ])) ? $params[ 'storage' ] : null, (isset($params[ 'meta' ])) ? $params[ 'meta' ] : null);
58
+        return $this->upload($bucketName, $keyName, $body, (isset($params['storage'])) ? $params['storage'] : null, (isset($params['meta'])) ? $params['meta'] : null);
59 59
     }
60 60
 
61 61
     /**
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
     public function validateParams(array $params = []): bool
67 67
     {
68 68
         return (
69
-                isset($params[ 'bucket' ]) and
70
-                isset($params[ 'key' ]) and
71
-                isset($params[ 'body' ])
69
+                isset($params['bucket']) and
70
+                isset($params['key']) and
71
+                isset($params['body'])
72 72
         );
73 73
     }
74 74
 
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
             ];
93 93
 
94 94
             if (null != $storage) {
95
-                $config[ 'StorageClass' ] = $storage;
95
+                $config['StorageClass'] = $storage;
96 96
             }
97 97
 
98 98
             if (null != $meta) {
99
-                $config[ 'Metadata' ] = $meta;
99
+                $config['Metadata'] = $meta;
100 100
             }
101 101
 
102
-            $config[ 'Metadata' ][ 'original_name' ] = File::getBaseName($keyName);
102
+            $config['Metadata']['original_name'] = File::getBaseName($keyName);
103 103
 
104 104
             $result = $this->client->getConn()->putObject($config);
105 105
 
106
-            if (($result instanceof ResultInterface) and $result[ '@metadata' ][ 'statusCode' ] === 200) {
106
+            if (($result instanceof ResultInterface) and $result['@metadata']['statusCode'] === 200) {
107 107
                 $this->commandHandlerLogger?->log($this, sprintf('File \'%s\' was successfully uploaded in \'%s\' bucket', $keyName, $bucketName));
108 108
 
109 109
                 if (null == $storage and $this->client->hasCache()) {
110 110
                     $version = null;
111
-                    if (isset($result[ '@metadata' ][ 'headers' ][ 'x-amz-version-id' ])) {
112
-                        $version = $result[ '@metadata' ][ 'headers' ][ 'x-amz-version-id' ];
111
+                    if (isset($result['@metadata']['headers']['x-amz-version-id'])) {
112
+                        $version = $result['@metadata']['headers']['x-amz-version-id'];
113 113
                     }
114 114
 
115 115
                     $this->client->getCache()->set($bucketName, $keyName, '', $version);
Please login to merge, or discard this patch.
src/Commands/Handlers/CreateBucketIfItDoesNotExist.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function handle(array $params = []): bool
35 35
     {
36
-        $bucketName = $params[ 'bucket' ];
36
+        $bucketName = $params['bucket'];
37 37
 
38 38
         if (false === S3BucketNameValidator::isValid($bucketName)) {
39 39
             throw new InvalidS3NameException(sprintf('%s is not a valid bucket name. [' . implode(', ', S3BucketNameValidator::validate($bucketName)) . ']', $bucketName));
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
                     'Bucket' => $bucketName
51 51
             ]);
52 52
 
53
-            if (isset($params[ 'rules' ]) and count($params[ 'rules' ]) > 0) {
54
-                $this->client->setBucketLifecycleConfiguration(['bucket' => $bucketName, 'rules' => $params[ 'rules' ]]);
53
+            if (isset($params['rules']) and count($params['rules']) > 0) {
54
+                $this->client->setBucketLifecycleConfiguration(['bucket' => $bucketName, 'rules' => $params['rules']]);
55 55
             }
56 56
 
57
-            if (isset($params[ 'accelerate' ]) and true === $params[ 'accelerate' ]) {
57
+            if (isset($params['accelerate']) and true === $params['accelerate']) {
58 58
                 $this->client->enableAcceleration(['bucket' => $bucketName]);
59 59
             }
60 60
 
61
-            if (($bucket instanceof ResultInterface) and $bucket[ '@metadata' ][ 'statusCode' ] === 200) {
61
+            if (($bucket instanceof ResultInterface) and $bucket['@metadata']['statusCode'] === 200) {
62 62
                 $this->commandHandlerLogger?->log($this, sprintf('Bucket \'%s\' was successfully created', $bucketName));
63 63
 
64 64
                 return true;
@@ -81,6 +81,6 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function validateParams(array $params = []): bool
83 83
     {
84
-        return isset($params[ 'bucket' ]);
84
+        return isset($params['bucket']);
85 85
     }
86 86
 }
Please login to merge, or discard this patch.