[Pkg-owncloud-commits] [php-sabredav] 48/163: Lots of formatting/docblock changes.
David Prévot
taffit at moszumanska.debian.org
Tue May 20 18:54:53 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag upstream/2.0.0_beta1
in repository php-sabredav.
commit 91096de5fb3b0a18427a3fc863e28ecf5c7c2d35
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Mon Apr 7 09:11:44 2014 -0400
Lots of formatting/docblock changes.
thnx @staabm
---
lib/Sabre/DAV/PropPatch.php | 25 +++++-----
lib/Sabre/DAV/Server.php | 108 --------------------------------------------
2 files changed, 11 insertions(+), 122 deletions(-)
diff --git a/lib/Sabre/DAV/PropPatch.php b/lib/Sabre/DAV/PropPatch.php
index ec4c206..9cbb6cf 100644
--- a/lib/Sabre/DAV/PropPatch.php
+++ b/lib/Sabre/DAV/PropPatch.php
@@ -73,7 +73,7 @@ class PropPatch {
*
* It's possible to specify more than one property.
*
- * @param string|array $properties
+ * @param string|string[] $properties
* @param callable $callback
* @return void
*/
@@ -96,8 +96,9 @@ class PropPatch {
return;
}
$this->propertyUpdateCallbacks[] = [
- // We need to set this as a string, so the commit function knows
- // how to format the arguments to the callback.
+ // If the original argument to this method was a string, we need
+ // to also make sure that it stays that way, so the commit function
+ // knows how to format the arguments to the callback.
is_string($properties)?$properties:$usedProperties,
$callback
];
@@ -109,7 +110,6 @@ class PropPatch {
* been handled by anything else yet. Note that you effectively claim with
* this that you promise to process _all_ properties that are coming in.
*
- * @param string|array $properties
* @param callable $callback
* @return void
*/
@@ -136,10 +136,7 @@ class PropPatch {
/**
* Sets the result code for one or more properties.
*
- * Properties can either be specified as a single string, or an array of
- * strings.
- *
- * @param string|array $properties
+ * @param string|string[] $properties
* @param int $resultCode
* @return void
*/
@@ -194,7 +191,7 @@ class PropPatch {
* This method returns true or false depending on if the operation was
* successful.
*
- * @return void
+ * @return bool
*/
public function commit() {
@@ -242,7 +239,7 @@ class PropPatch {
/**
* Executes a property callback with the single-property syntax.
- *
+ *
* @param string $propertyName
* @param callable $callback
* @return void
@@ -251,7 +248,7 @@ class PropPatch {
$result = $callback($this->mutations[$propertyName]);
if (is_bool($result)) {
- if ($result) {
+ if ($result) {
if (is_null($this->mutations[$propertyName])) {
// Delete
$result = 204;
@@ -262,7 +259,7 @@ class PropPatch {
} else {
// Fail
$result = 403;
- }
+ }
}
if (!is_int($result)) {
throw new UnexpectedValueException('A callback sent to handle() did not return an int or a bool');
@@ -276,8 +273,8 @@ class PropPatch {
/**
* Executes a property callback with the multi-property syntax.
- *
- * @param array $propertyName
+ *
+ * @param array $propertyList
* @param callable $callback
* @return void
*/
diff --git a/lib/Sabre/DAV/Server.php b/lib/Sabre/DAV/Server.php
index 9a4a13b..522d388 100644
--- a/lib/Sabre/DAV/Server.php
+++ b/lib/Sabre/DAV/Server.php
@@ -1327,114 +1327,6 @@ class Server extends EventEmitter {
return $propPatch->getResult();
- /*
- $restructuredResult = [];
- foreach($result as $key=>$value) {
- if (isset($restructedResult[$value])) {
- $restructedResult[$value] = [
- $key => null,
- ];
- }
- }
-
-
- // we'll start by grabbing the node, this will throw the appropriate
- // exceptions if it doesn't.
- $node = $this->tree->getNodeForPath($uri);
-
- $result = [
- 200 => [],
- 403 => [],
- 424 => [],
- ];
- $remainingProperties = $properties;
- $hasError = false;
-
- // Running through all properties to make sure none of them are protected
- if (!$hasError) foreach($properties as $propertyName => $value) {
- if(in_array($propertyName, $this->protectedProperties)) {
- $result[403][$propertyName] = null;
- unset($remainingProperties[$propertyName]);
- $hasError = true;
- }
- }
-
- if (!$hasError) {
- // Allowing plugins to take care of property updating
- $hasError = !$this->emit('updateProperties', [
- &$remainingProperties,
- &$result,
- $node
- ]);
- }
-
- // If the node is not an instance of Sabre\DAV\IProperties, every
- // property is 403 Forbidden
- if (!$hasError && count($remainingProperties) && !($node instanceof IProperties)) {
- $hasError = true;
- foreach($properties as $propertyName=> $value) {
- $result[403][$propertyName] = null;
- }
- $remainingProperties = [];
- }
-
- // Only if there were no errors we may attempt to update the resource
- if (!$hasError) {
-
- if (count($remainingProperties)>0) {
-
- $updateResult = $node->updateProperties($remainingProperties);
-
- if ($updateResult===true) {
- // success
- foreach($remainingProperties as $propertyName=>$value) {
- $result[200][$propertyName] = null;
- }
-
- } elseif ($updateResult===false) {
- // The node failed to update the properties for an
- // unknown reason
- foreach($remainingProperties as $propertyName=>$value) {
- $result[403][$propertyName] = null;
- }
-
- } elseif (is_array($updateResult)) {
-
- // The node has detailed update information
- // We need to merge the results with the earlier results.
- foreach($updateResult as $status => $props) {
- if (is_array($props)) {
- if (!isset($result[$status]))
- $result[$status] = [];
-
- $result[$status] = array_merge($result[$status], $updateResult[$status]);
- }
- }
-
- } else {
- throw new Exception('Invalid result from updateProperties');
- }
- $remainingProperties = [];
- }
-
- }
-
- foreach($remainingProperties as $propertyName=>$value) {
- // if there are remaining properties, it must mean
- // there's a dependency failure
- $result[424][$propertyName] = null;
- }
-
- // Removing empty array values
- foreach($result as $status=>$props) {
-
- if (count($props)===0) unset($result[$status]);
-
- }
- $result['href'] = $uri;
- return $result;
- */
-
}
/**
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list