Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tab-to-spaces, PHPDoc adjusted/added and namespaces cleaned

  • Loading branch information...
commit 0ee5a99adc9c1b9a0d646099f6759a9e4a6e9c3f 1 parent e63fd7e
@DeepDiver1975 DeepDiver1975 authored
View
4 lib/Sabre/DAV/CorePlugin.php
@@ -316,8 +316,8 @@ public function httpPropfind(RequestInterface $request, ResponseInterface $respo
);
$depth = $this->server->getHTTPDepth(1);
- // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
- if (!$this->server->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
+ // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
+ if (!$this->server->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
$newProperties = $this->server->getPropertiesForPath($path,$requestedProperties,$depth);
View
45 lib/Sabre/DAV/Server.php
@@ -156,7 +156,7 @@ class Server extends EventEmitter {
* This property allows you to automatically add the 'resourcetype' value
* based on a node's classname or interface.
*
- * The preset ensures that {DAV:}collection is automaticlly added for nodes
+ * The preset ensures that {DAV:}collection is automatically added for nodes
* implementing Sabre\DAV\ICollection.
*
* @var array
@@ -165,7 +165,12 @@ class Server extends EventEmitter {
'Sabre\\DAV\\ICollection' => '{DAV:}collection',
];
- public $enablePropfindDepthInfinity = false;
+ /**
+ * This property allows the usage of depth INFINITY.
+ *
+ * @var bool
+ */
+ public $enablePropfindDepthInfinity = false;
/**
* If this setting is turned off, SabreDAV's version number will be hidden
@@ -846,18 +851,18 @@ public function getHTTPHeaders($path) {
}
- /**
- * Small helper to support PROPFIND with DEPTH_INFINITY.
- */
- private function addPathNodesRecursively(&$nodes, $path) {
- foreach($this->tree->getChildren($path) as $childNode) {
- $nodes[$path . '/' . $childNode->getName()] = $childNode;
- if ($childNode instanceof \Sabre\DAV\ICollection)
- $this->addPathNodesRecursively($nodes, $path . '/' . $childNode->getName());
- }
- }
-
- /**
+ /**
+ * Small helper to support PROPFIND with DEPTH_INFINITY.
+ */
+ private function addPathNodesRecursively(&$nodes, $path) {
+ foreach($this->tree->getChildren($path) as $childNode) {
+ $nodes[$path . '/' . $childNode->getName()] = $childNode;
+ if ($childNode instanceof ICollection)
+ $this->addPathNodesRecursively($nodes, $path . '/' . $childNode->getName());
+ }
+ }
+
+ /**
* Returns a list of properties for a given path
*
* The path that should be supplied should have the baseUrl stripped out
@@ -873,10 +878,10 @@ private function addPathNodesRecursively(&$nodes, $path) {
*/
public function getPropertiesForPath($path, $propertyNames = [], $depth = 0) {
- // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
- if (!$this->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
+ // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
+ if (!$this->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
- $path = rtrim($path,'/');
+ $path = rtrim($path,'/');
// This event allows people to intercept these requests early on in the
// process.
@@ -894,12 +899,12 @@ public function getPropertiesForPath($path, $propertyNames = [], $depth = 0) {
if ($depth==1 && $parentNode instanceof ICollection) {
foreach($this->tree->getChildren($path) as $childNode)
$nodes[$path . '/' . $childNode->getName()] = $childNode;
- } else if ($depth == self::DEPTH_INFINITY && $parentNode instanceof \Sabre\DAV\ICollection) {
- $this->addPathNodesRecursively($nodes, $path);
+ } else if ($depth == self::DEPTH_INFINITY && $parentNode instanceof ICollection) {
+ $this->addPathNodesRecursively($nodes, $path);
}
- foreach($nodes as $myPath=>$node) {
+ foreach($nodes as $myPath=>$node) {
$r = $this->getPropertiesByNode($myPath, $node, $propertyNames);
if ($r) {
View
9 tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
@@ -3,7 +3,6 @@
namespace Sabre\DAV;
use Sabre\HTTP;
-require_once 'Sabre/HTTP/ResponseMock.php';
require_once 'Sabre/DAV/AbstractServer.php';
class ServerPropsInfiniteDepthTest extends AbstractServer {
@@ -19,11 +18,11 @@ function setUp() {
if (file_exists(SABRE_TEMPDIR.'../.sabredav')) unlink(SABRE_TEMPDIR.'../.sabredav');
parent::setUp();
file_put_contents(SABRE_TEMPDIR . '/test2.txt', 'Test contents2');
- mkdir(SABRE_TEMPDIR . '/col');
- mkdir(SABRE_TEMPDIR . '/col/col');
+ mkdir(SABRE_TEMPDIR . '/col');
+ mkdir(SABRE_TEMPDIR . '/col/col');
file_put_contents(SABRE_TEMPDIR . 'col/col/test.txt', 'Test contents');
$this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR . '/.locksdb')));
- $this->server->enablePropfindDepthInfinity = true;
+ $this->server->enablePropfindDepthInfinity = true;
}
@@ -87,7 +86,7 @@ public function testPropFindEmptyBody() {
$this->assertEquals('/',(string)$data,'href element should have been /');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype');
- // 8 resources are to be returned: /, col, col/col, col/col/test.txt, dir, dir/child.txt, test.txt and test2.txt
+ // 8 resources are to be returned: /, col, col/col, col/col/test.txt, dir, dir/child.txt, test.txt and test2.txt
$this->assertEquals(8,count($data));
}
Please sign in to comment.
Something went wrong with that request. Please try again.