Skip to content

Commit f9fa76c

Browse files
committed
chore(cs): Apply autofixes
Signed-off-by: Joas Schilling <[email protected]>
1 parent 7bfe60d commit f9fa76c

File tree

3 files changed

+45
-45
lines changed

3 files changed

+45
-45
lines changed

Diff for: lib/Operation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected function translatePath(IStorage $storage, string $path): string {
138138
return 'files/' . $innerPath;
139139
} elseif ($folder === 'thumbnails') {
140140
[$fileId,] = explode('/', $innerPath, 2);
141-
$innerPath = $storage->getCache()->getPathById((int) $fileId);
141+
$innerPath = $storage->getCache()->getPathById((int)$fileId);
142142

143143
if ($innerPath !== null) {
144144
return 'files/' . $innerPath;

Diff for: tests/Integration/features/bootstrap/FeatureContext.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function theWebdavResponseShouldHaveAStatusCode($statusCode) {
124124
if (str_contains($statusCode, '|')) {
125125
$statusCodes = array_map('intval', explode('|', $statusCode));
126126
} else {
127-
$statusCodes = [(int) $statusCode];
127+
$statusCodes = [(int)$statusCode];
128128
}
129129
if (!in_array($this->response->getStatusCode(), $statusCodes, true)) {
130130
throw new \Exception("Expected $statusCode, got ".$this->response->getStatusCode());

Diff for: tests/Integration/features/bootstrap/WebDav.php

+43-43
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
trait WebDav {
1313
/** @var string */
14-
private $davPath = "remote.php/webdav";
14+
private $davPath = 'remote.php/webdav';
1515
/** @var boolean */
1616
private $usingOldDavPath = true;
1717
/** @var array map with user as key and another map as value, which has path as key and etag as value */
@@ -30,15 +30,15 @@ public function usingDavPath($davPath) {
3030
* @Given /^using old dav path$/
3131
*/
3232
public function usingOldDavPath() {
33-
$this->davPath = "remote.php/webdav";
33+
$this->davPath = 'remote.php/webdav';
3434
$this->usingOldDavPath = true;
3535
}
3636

3737
/**
3838
* @Given /^using new dav path$/
3939
*/
4040
public function usingNewDavPath() {
41-
$this->davPath = "remote.php/dav";
41+
$this->davPath = 'remote.php/dav';
4242
$this->usingOldDavPath = false;
4343
}
4444

@@ -50,10 +50,10 @@ public function getDavFilesPath($user) {
5050
}
5151
}
5252

53-
public function makeDavRequest($user, $method, $path, $headers, $body = null, $type = "files") {
54-
if ($type === "files") {
53+
public function makeDavRequest($user, $method, $path, $headers, $body = null, $type = 'files') {
54+
if ($type === 'files') {
5555
$fullUrl = $this->baseUrl . $this->getDavFilesPath($user) . "$path";
56-
} elseif ($type === "uploads") {
56+
} elseif ($type === 'uploads') {
5757
$fullUrl = $this->baseUrl . $this->davPath . "$path";
5858
} else {
5959
$fullUrl = $this->baseUrl . $this->davPath . '/' . $type . "$path";
@@ -80,7 +80,7 @@ public function makeDavRequest($user, $method, $path, $headers, $body = null, $t
8080
public function userMovedFile($user, $entry, $fileSource, $fileDestination) {
8181
$fullUrl = $this->baseUrl . $this->getDavFilesPath($user);
8282
$headers['Destination'] = $fullUrl . $fileDestination;
83-
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
83+
$this->response = $this->makeDavRequest($user, 'MOVE', $fileSource, $headers);
8484
Assert::assertEquals(201, $this->response->getStatusCode());
8585
}
8686

@@ -94,7 +94,7 @@ public function userMovesFile($user, $entry, $fileSource, $fileDestination) {
9494
$fullUrl = $this->baseUrl . $this->getDavFilesPath($user);
9595
$headers['Destination'] = $fullUrl . $fileDestination;
9696
try {
97-
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
97+
$this->response = $this->makeDavRequest($user, 'MOVE', $fileSource, $headers);
9898
} catch (\GuzzleHttp\Exception\ClientException $e) {
9999
$this->response = $e->getResponse();
100100
}
@@ -126,7 +126,7 @@ public function userCopiesFileTo($user, $entry, $fileSource, $fileDestination) {
126126
public function downloadFileWithRange($fileSource, $range) {
127127
$headers['Range'] = $range;
128128
try {
129-
$this->response = $this->makeDavRequest($this->currentUser, "GET", $fileSource, $headers);
129+
$this->response = $this->makeDavRequest($this->currentUser, 'GET', $fileSource, $headers);
130130
} catch (\GuzzleHttp\Exception\ClientException $e) {
131131
$this->response = $e->getResponse();
132132
}
@@ -138,16 +138,16 @@ public function downloadFileWithRange($fileSource, $range) {
138138
*/
139139
public function downloadPublicFileWithRange($range) {
140140
$token = $this->lastShareData->data->token;
141-
$fullUrl = $this->baseUrl . "public.php/webdav";
141+
$fullUrl = $this->baseUrl . 'public.php/webdav';
142142

143143
$client = new GClient();
144144
$options = [];
145-
$options['auth'] = [$token, ""];
145+
$options['auth'] = [$token, ''];
146146
$options['headers'] = [
147147
'Range' => $range
148148
];
149149

150-
$this->response = $client->request("GET", $fullUrl, $options);
150+
$this->response = $client->request('GET', $fullUrl, $options);
151151
}
152152

153153
/**
@@ -156,17 +156,17 @@ public function downloadPublicFileWithRange($range) {
156156
*/
157157
public function downloadPublicFileInsideAFolderWithRange($path, $range) {
158158
$token = $this->lastShareData->data->token;
159-
$fullUrl = $this->baseUrl . "public.php/webdav" . "$path";
159+
$fullUrl = $this->baseUrl . 'public.php/webdav' . "$path";
160160

161161
$client = new GClient();
162162
$options = [
163163
'headers' => [
164164
'Range' => $range
165165
]
166166
];
167-
$options['auth'] = [$token, ""];
167+
$options['auth'] = [$token, ''];
168168

169-
$this->response = $client->request("GET", $fullUrl, $options);
169+
$this->response = $client->request('GET', $fullUrl, $options);
170170
}
171171

172172
/**
@@ -314,7 +314,7 @@ public function theSingleResponseShouldContainAPropertyWithValue($key, $expected
314314
public function theResponseShouldContainAShareTypesPropertyWith($table) {
315315
$keys = $this->response;
316316
if (!array_key_exists('{http://owncloud.org/ns}share-types', $keys)) {
317-
throw new \Exception("Cannot find property \"{http://owncloud.org/ns}share-types\"");
317+
throw new \Exception('Cannot find property "{http://owncloud.org/ns}share-types"');
318318
}
319319

320320
$foundTypes = [];
@@ -481,7 +481,7 @@ public function searchFile(string $user, ?string $properties = null, ?string $sc
481481
</d:searchrequest>';
482482

483483
try {
484-
$this->response = $this->makeDavRequest($user, "SEARCH", '', [
484+
$this->response = $this->makeDavRequest($user, 'SEARCH', '', [
485485
'Content-Type' => 'text/xml'
486486
], $body, '');
487487
} catch (\GuzzleHttp\Exception\ServerException $e) {
@@ -555,9 +555,9 @@ public function checkElementList($user, $expectedElements) {
555555
$elementRows = $expectedElements->getRows();
556556
$elementsSimplified = $this->simplifyArray($elementRows);
557557
foreach ($elementsSimplified as $expectedElement) {
558-
$webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement;
558+
$webdavPath = '/' . $this->getDavFilesPath($user) . $expectedElement;
559559
if (!array_key_exists($webdavPath, $elementList)) {
560-
Assert::fail("$webdavPath" . " is not in propfind answer");
560+
Assert::fail("$webdavPath" . ' is not in propfind answer');
561561
}
562562
}
563563
}
@@ -572,7 +572,7 @@ public function checkElementList($user, $expectedElements) {
572572
public function userUploadsAFileTo($user, $source, $destination) {
573573
$file = \GuzzleHttp\Psr7\Utils::streamFor(fopen($source, 'r'));
574574
try {
575-
$this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file);
575+
$this->response = $this->makeDavRequest($user, 'PUT', $destination, [], $file);
576576
} catch (\GuzzleHttp\Exception\ServerException $e) {
577577
// 5xx responses cause a server exception
578578
$this->response = $e->getResponse();
@@ -589,11 +589,11 @@ public function userUploadsAFileTo($user, $source, $destination) {
589589
* @param string $destination
590590
*/
591591
public function userAddsAFileTo($user, $bytes, $destination) {
592-
$filename = "filespecificSize.txt";
592+
$filename = 'filespecificSize.txt';
593593
$this->createFileSpecificSize($filename, $bytes);
594594
Assert::assertEquals(1, file_exists("work/$filename"));
595595
$this->userUploadsAFileTo($user, "work/$filename", $destination);
596-
$this->removeFile("work/", $filename);
596+
$this->removeFile('work/', $filename);
597597
$expectedElements = new \Behat\Gherkin\Node\TableNode([["$destination"]]);
598598
$this->checkElementList($user, $expectedElements);
599599
}
@@ -604,7 +604,7 @@ public function userAddsAFileTo($user, $bytes, $destination) {
604604
public function userUploadsAFileWithContentTo($user, $content, $destination) {
605605
$file = \GuzzleHttp\Psr7\Utils::streamFor($content);
606606
try {
607-
$this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file);
607+
$this->response = $this->makeDavRequest($user, 'PUT', $destination, [], $file);
608608
} catch (\GuzzleHttp\Exception\ServerException $e) {
609609
// 5xx responses cause a server exception
610610
$this->response = $e->getResponse();
@@ -650,7 +650,7 @@ public function emptyTrashbin($user) {
650650
public function userCreatedAFolder($user, $destination) {
651651
try {
652652
$destination = '/' . ltrim($destination, '/');
653-
$this->response = $this->makeDavRequest($user, "MKCOL", $destination, []);
653+
$this->response = $this->makeDavRequest($user, 'MKCOL', $destination, []);
654654
} catch (\GuzzleHttp\Exception\ServerException $e) {
655655
// 5xx responses cause a server exception
656656
$this->response = $e->getResponse();
@@ -672,7 +672,7 @@ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $d
672672
$num -= 1;
673673
$data = \GuzzleHttp\Psr7\Utils::streamFor($data);
674674
$file = $destination . '-chunking-42-' . $total . '-' . $num;
675-
$this->makeDavRequest($user, 'PUT', $file, ['OC-Chunked' => '1'], $data, "uploads");
675+
$this->makeDavRequest($user, 'PUT', $file, ['OC-Chunked' => '1'], $data, 'uploads');
676676
}
677677

678678
/**
@@ -686,28 +686,28 @@ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $d
686686
* @param string $content3
687687
*/
688688
public function userUploadsBulkedFiles($user, $name1, $content1, $name2, $content2, $name3, $content3) {
689-
$boundary = "boundary_azertyuiop";
689+
$boundary = 'boundary_azertyuiop';
690690

691-
$body = "";
691+
$body = '';
692692
$body .= '--'.$boundary."\r\n";
693-
$body .= "X-File-Path: ".$name1."\r\n";
693+
$body .= 'X-File-Path: '.$name1."\r\n";
694694
$body .= "X-File-MD5: f6a6263167c92de8644ac998b3c4e4d1\r\n";
695695
$body .= "X-OC-Mtime: 1111111111\r\n";
696-
$body .= "Content-Length: ".strlen($content1)."\r\n";
696+
$body .= 'Content-Length: '.strlen($content1)."\r\n";
697697
$body .= "\r\n";
698698
$body .= $content1."\r\n";
699699
$body .= '--'.$boundary."\r\n";
700-
$body .= "X-File-Path: ".$name2."\r\n";
700+
$body .= 'X-File-Path: '.$name2."\r\n";
701701
$body .= "X-File-MD5: 87c7d4068be07d390a1fffd21bf1e944\r\n";
702702
$body .= "X-OC-Mtime: 2222222222\r\n";
703-
$body .= "Content-Length: ".strlen($content2)."\r\n";
703+
$body .= 'Content-Length: '.strlen($content2)."\r\n";
704704
$body .= "\r\n";
705705
$body .= $content2."\r\n";
706706
$body .= '--'.$boundary."\r\n";
707-
$body .= "X-File-Path: ".$name3."\r\n";
707+
$body .= 'X-File-Path: '.$name3."\r\n";
708708
$body .= "X-File-MD5: e86a1cf0678099986a901c79086f5617\r\n";
709709
$body .= "X-File-Mtime: 3333333333\r\n";
710-
$body .= "Content-Length: ".strlen($content3)."\r\n";
710+
$body .= 'Content-Length: '.strlen($content3)."\r\n";
711711
$body .= "\r\n";
712712
$body .= $content3."\r\n";
713713
$body .= '--'.$boundary."--\r\n";
@@ -726,15 +726,15 @@ public function userUploadsBulkedFiles($user, $name1, $content1, $name2, $conten
726726
'body' => $body
727727
];
728728

729-
return $client->request("POST", $this->baseUrl . "remote.php/dav/bulk", $options);
729+
return $client->request('POST', $this->baseUrl . 'remote.php/dav/bulk', $options);
730730
}
731731

732732
/**
733733
* @Given user :user creates a new chunking upload with id :id
734734
*/
735735
public function userCreatesANewChunkingUploadWithId($user, $id) {
736736
$destination = '/uploads/' . $user . '/' . $id;
737-
$this->makeDavRequest($user, 'MKCOL', $destination, [], null, "uploads");
737+
$this->makeDavRequest($user, 'MKCOL', $destination, [], null, 'uploads');
738738
}
739739

740740
/**
@@ -743,7 +743,7 @@ public function userCreatesANewChunkingUploadWithId($user, $id) {
743743
public function userUploadsNewChunkFileOfWithToId($user, $num, $data, $id) {
744744
$data = \GuzzleHttp\Psr7\Utils::streamFor($data);
745745
$destination = '/uploads/' . $user . '/' . $id . '/' . $num;
746-
$this->makeDavRequest($user, 'PUT', $destination, [], $data, "uploads");
746+
$this->makeDavRequest($user, 'PUT', $destination, [], $data, 'uploads');
747747
}
748748

749749
/**
@@ -754,7 +754,7 @@ public function userMovesNewChunkFileWithIdToMychunkedfile($user, $id, $dest) {
754754
$destination = $this->baseUrl . $this->getDavFilesPath($user) . $dest;
755755
$this->makeDavRequest($user, 'MOVE', $source, [
756756
'Destination' => $destination
757-
], null, "uploads");
757+
], null, 'uploads');
758758
}
759759

760760
/**
@@ -768,7 +768,7 @@ public function userMovesNewChunkFileWithIdToMychunkedfileWithSize($user, $id, $
768768
$this->response = $this->makeDavRequest($user, 'MOVE', $source, [
769769
'Destination' => $destination,
770770
'OC-Total-Length' => $size
771-
], null, "uploads");
771+
], null, 'uploads');
772772
} catch (\GuzzleHttp\Exception\BadResponseException $ex) {
773773
$this->response = $ex->getResponse();
774774
}
@@ -906,9 +906,9 @@ public function checkFavoritedElements($user, $folder, $expectedElements) {
906906
$elementRows = $expectedElements->getRows();
907907
$elementsSimplified = $this->simplifyArray($elementRows);
908908
foreach ($elementsSimplified as $expectedElement) {
909-
$webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement;
909+
$webdavPath = '/' . $this->getDavFilesPath($user) . $expectedElement;
910910
if (!array_key_exists($webdavPath, $elementList)) {
911-
Assert::fail("$webdavPath" . " is not in report answer");
911+
Assert::fail("$webdavPath" . ' is not in report answer');
912912
}
913913
}
914914
}
@@ -923,12 +923,12 @@ public function userDeletesEverythingInFolder($user, $folder) {
923923
$elementList = $this->listFolder($user, $folder, 1);
924924
$elementListKeys = array_keys($elementList);
925925
array_shift($elementListKeys);
926-
$davPrefix = "/" . $this->getDavFilesPath($user);
926+
$davPrefix = '/' . $this->getDavFilesPath($user);
927927
foreach ($elementListKeys as $element) {
928928
if (substr($element, 0, strlen($davPrefix)) == $davPrefix) {
929929
$element = substr($element, strlen($davPrefix));
930930
}
931-
$this->userDeletesFile($user, "element", $element);
931+
$this->userDeletesFile($user, 'element', $element);
932932
}
933933
}
934934

@@ -963,7 +963,7 @@ public function userSeesNoFilesInTheTrashbin($user) {
963963
* @return int
964964
*/
965965
private function getFileIdForPath($user, $path) {
966-
$propertiesTable = new \Behat\Gherkin\Node\TableNode([["{http://owncloud.org/ns}fileid"]]);
966+
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{http://owncloud.org/ns}fileid']]);
967967
$this->asGetsPropertiesOfFolderWith($user, 'file', $path, $propertiesTable);
968968
return (int)$this->response['{http://owncloud.org/ns}fileid'];
969969
}

0 commit comments

Comments
 (0)