Skip to content

Commit 8dc4522

Browse files
committed
chore: Fix code style
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 069c16d commit 8dc4522

File tree

6 files changed

+30
-25
lines changed

6 files changed

+30
-25
lines changed

lib/DAV/CorePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ public function httpMove(RequestInterface $request, ResponseInterface $response)
590590
$moveInfo = $this->server->getCopyAndMoveInfo($request);
591591

592592
// MOVE does only allow "infinity" every other header value is considered invalid
593-
if ($moveInfo['depth'] !== 'infinity') {
593+
if ('infinity' !== $moveInfo['depth']) {
594594
throw new BadRequest('The HTTP Depth header must only contain "infinity" for MOVE');
595595
}
596596

lib/DAV/ICopyTarget.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ interface ICopyTarget extends ICollection
2828
* is that the copy was successful.
2929
* If you return false, sabre/dav will handle the copy itself.
3030
*
31-
* @param string $targetName new local file/collection name
32-
* @param string $sourcePath Full path to source node
33-
* @param INode $sourceNode Source node itself
34-
* @param string|int $depth How many level of children to copy.
35-
* The value can be 'infinity' or a positiv number including zero.
36-
* Zero means to only copy a shallow collection with props but without children.
31+
* @param string $targetName new local file/collection name
32+
* @param string $sourcePath Full path to source node
33+
* @param INode $sourceNode Source node itself
34+
* @param string|int $depth How many level of children to copy.
35+
* The value can be 'infinity' or a positiv number including zero.
36+
* Zero means to only copy a shallow collection with props but without children.
3737
*
3838
* @return bool
3939
*/

lib/DAV/Server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,8 @@ public function getCopyAndMoveInfo(RequestInterface $request)
728728

729729
// Depth of inifinty is valid for MOVE and COPY. If it is not set the RFC requires to act like it was 'infinity'.
730730
$depth = strtolower($request->getHeader('Depth') ?? 'infinity');
731-
if ($depth !== 'infinity' && is_numeric($depth)) {
732-
$depth = (int)$depth;
731+
if ('infinity' !== $depth && is_numeric($depth)) {
732+
$depth = (int) $depth;
733733
if ($depth < 0) {
734734
throw new Exception\BadRequest('The HTTP Depth header may only be "infinity", 0 or a positiv number');
735735
}

lib/DAV/Tree.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ public function nodeExists($path)
135135
/**
136136
* Copies a file from path to another.
137137
*
138-
* @param string $sourcePath The source location
139-
* @param string $destinationPath The full destination path
140-
* @param int|string $depth How much levle of children to copy.
141-
* The value can be 'infinity' or a positiv integer, including zero.
142-
* Zero means only copy the collection without children but with its properties.
138+
* @param string $sourcePath The source location
139+
* @param string $destinationPath The full destination path
140+
* @param int|string $depth How much levle of children to copy.
141+
* The value can be 'infinity' or a positiv integer, including zero.
142+
* Zero means only copy the collection without children but with its properties.
143143
*/
144144
public function copy($sourcePath, $destinationPath, $depth = 'infinity')
145145
{
@@ -310,8 +310,8 @@ public function getMultipleNodes($paths)
310310
/**
311311
* copyNode.
312312
*
313-
* @param string $destinationName
314-
* @param int|string $depth How many children of the node to copy
313+
* @param string $destinationName
314+
* @param int|string $depth How many children of the node to copy
315315
*/
316316
protected function copyNode(INode $source, ICollection $destinationParent, ?string $destinationName = null, $depth = 'infinity')
317317
{
@@ -338,9 +338,9 @@ protected function copyNode(INode $source, ICollection $destinationParent, ?stri
338338
$destination = $destinationParent->getChild($destinationName);
339339

340340
// Copy children if depth is not zero
341-
if ($depth !== 0) {
341+
if (0 !== $depth) {
342342
// Adjust next depth for children (keep 'infinity' or decrease)
343-
$depth = $depth === 'infinity' ? 'infinity' : $depth - 1;
343+
$depth = 'infinity' === $depth ? 'infinity' : $depth - 1;
344344
$destination = $destinationParent->getChild($destinationName);
345345
foreach ($source->getChildren() as $child) {
346346
$this->copyNode($child, $destination, null, $depth);

tests/Sabre/DAV/CorePluginTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@ public function testGetInfo()
1616
self::assertEquals('core', $corePlugin->getPluginInfo()['name']);
1717
}
1818

19-
public function moveInvalidDepthHeaderProvider() {
19+
public function moveInvalidDepthHeaderProvider()
20+
{
2021
return [
2122
[0],
2223
[1],
2324
];
2425
}
2526

2627
/**
27-
* MOVE does only allow "infinity" every other header value is considered invalid
28+
* MOVE does only allow "infinity" every other header value is considered invalid.
29+
*
2830
* @dataProvider moveInvalidDepthHeaderProvider
2931
*/
30-
public function testMoveWithInvalidDepth($depthHeader) {
32+
public function testMoveWithInvalidDepth($depthHeader)
33+
{
3134
$request = new HTTP\Request('MOVE', '/path/');
3235
$response = new HTTP\Response();
3336

@@ -45,9 +48,10 @@ public function testMoveWithInvalidDepth($depthHeader) {
4548
}
4649

4750
/**
48-
* MOVE does only allow "infinity" every other header value is considered invalid
51+
* MOVE does only allow "infinity" every other header value is considered invalid.
4952
*/
50-
public function testMoveSupportsDepth() {
53+
public function testMoveSupportsDepth()
54+
{
5155
$request = new HTTP\Request('MOVE', '/path/');
5256
$response = new HTTP\Response();
5357

tests/Sabre/DAV/Mock/PropertiesCollection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function propPatch(PropPatch $proppatch)
4949
foreach ($updateProperties as $k => $v) {
5050
$this->properties[$k] = $v;
5151
}
52+
5253
return true;
5354
case 'updatepropsarray':
5455
$r = [];
@@ -81,7 +82,7 @@ public function propPatch(PropPatch $proppatch)
8182
*/
8283
public function getProperties($requestedProperties)
8384
{
84-
if (count($requestedProperties) === 0) {
85+
if (0 === count($requestedProperties)) {
8586
return $this->properties;
8687
}
8788

@@ -97,7 +98,7 @@ public function getProperties($requestedProperties)
9798
}
9899

99100
/**
100-
* Creates a new subdirectory. (Override to ensure props are preserved)
101+
* Creates a new subdirectory. (Override to ensure props are preserved).
101102
*
102103
* @param string $name
103104
*/

0 commit comments

Comments
 (0)