Skip to content

Commit

Permalink
feat: tidy up client PROPFIND code and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Dec 11, 2023
1 parent eece860 commit 8a77009
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions lib/DAV/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,18 @@ public function __construct(array $settings)
* The list of requested properties must be specified as an array, in clark
* notation.
*
* The returned array will contain a list of filenames as keys, and
* properties as values.
*
* The properties array will contain the list of properties. Only properties
* that are actually returned from the server (without error) will be
* returned, anything else is discarded.
*
* Depth should be either 0 or 1. A depth of 1 will cause a request to be
* made to the server to also return all child resources.
*
* For depth 0, just the array of properties for the resource is returned.
*
* For depth 1, the returned array will contain a list of resource names as keys,
* and an array of properties as values.
*
* The array of properties will contain the properties as keys with their values as the value.
* Only properties that are actually returned from the server without error will be
* returned, anything else is discarded.
*
* @param string $url
* @param int $depth
*
Expand Down Expand Up @@ -220,15 +222,19 @@ public function propFind($url, array $properties, $depth = 0)
* The list of requested properties must be specified as an array, in clark
* notation.
*
* The returned array will contain a list of filenames as keys, and
* properties as values.
*
* The properties array will contain the list of properties. All properties
* that are actually returned from the server are returned by this method.
*
* Depth should be either 0 or 1. A depth of 1 will cause a request to be
* made to the server to also return all child resources.
*
* For depth 0, just the multi-level array of status and properties for the resource is returned.
*
* For depth 1, the returned array will contain a list of resources as keys and
* a multi-level array containing status and properties as value.
*
* The multi-level array of status and properties is formatted the same as what is
* documented for parseMultiStatus.
*
* All properties that are actually returned from the server are returned by this method.
*
* @param string $url
* @param int $depth
*
Expand All @@ -237,7 +243,6 @@ public function propFind($url, array $properties, $depth = 0)
public function propFindUnfiltered($url, array $properties, $depth = 0)
{
$result = $this->doPropFind($url, $properties, $depth);
$newResult = [];

// If depth was 0, we only return the top item
if (0 === $depth) {
Expand All @@ -255,14 +260,15 @@ public function propFindUnfiltered($url, array $properties, $depth = 0)
* The list of requested properties must be specified as an array, in clark
* notation.
*
* The returned array will contain a list of filenames as keys, and
* properties as values.
*
* The properties array will contain the list of properties.
*
* Depth should be either 0 or 1. A depth of 1 will cause a request to be
* made to the server to also return all child resources.
*
* The returned array will contain a list of resources as keys and
* a multi-level array containing status and properties as value.
*
* The multi-level array of status and properties is formatted the same as what is
* documented for parseMultiStatus.
*
* @param string $url
* @param int $depth
*
Expand Down Expand Up @@ -306,9 +312,7 @@ private function doPropFind($url, array $properties, $depth = 0)
throw new HTTP\ClientHttpException($response);
}

$result = $this->parseMultiStatus($response->getBodyAsString());

return $result;
return $this->parseMultiStatus($response->getBodyAsString());
}

/**
Expand Down

0 comments on commit 8a77009

Please sign in to comment.