From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../sabre/dav/tests/Sabre/DAV/Mock/Collection.php | 73 ++++++++----------- vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php | 84 ++++++++++------------ 2 files changed, 67 insertions(+), 90 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/DAV/Mock') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php b/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php index fded5e474..e0bdecc09 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php @@ -1,5 +1,7 @@ name = $name; foreach ($children as $key => $value) { if (is_string($value)) { @@ -48,7 +49,6 @@ class Collection extends DAV\Collection { } } $this->parent = $parent; - } /** @@ -58,14 +58,13 @@ class Collection extends DAV\Collection { * * @return string */ - function getName() { - + public function getName() + { return $this->name; - } /** - * Creates a new file in the directory + * Creates a new file in the directory. * * Data will either be supplied as a stream resource, or in certain cases * as a string. Keep in mind that you may have to support either. @@ -84,41 +83,39 @@ class Collection extends DAV\Collection { * return the same contents of what was submitted here, you are strongly * recommended to omit the ETag. * - * @param string $name Name of the file + * @param string $name Name of the file * @param resource|string $data Initial payload - * @return null|string + * + * @return string|null */ - function createFile($name, $data = null) { - + public function createFile($name, $data = '') + { if (is_resource($data)) { $data = stream_get_contents($data); } $this->children[] = new File($name, $data, $this); - return '"' . md5($data) . '"'; + return '"'.md5($data).'"'; } /** - * Creates a new subdirectory + * Creates a new subdirectory. * * @param string $name - * @return void */ - function createDirectory($name) { - + public function createDirectory($name) + { $this->children[] = new self($name); - } /** - * Returns an array with all the child nodes + * Returns an array with all the child nodes. * * @return \Sabre\DAV\INode[] */ - function getChildren() { - + public function getChildren() + { return $this->children; - } /** @@ -126,43 +123,35 @@ class Collection extends DAV\Collection { * * @param \Sabre\DAV\INode $node */ - function addNode(\Sabre\DAV\INode $node) { - + public function addNode(\Sabre\DAV\INode $node) + { $this->children[] = $node; - } /** * Removes a childnode from this node. * * @param string $name - * @return void */ - function deleteChild($name) { - + public function deleteChild($name) + { foreach ($this->children as $key => $value) { - if ($value->getName() == $name) { unset($this->children[$key]); + return; } - } - } /** * Deletes this collection and all its children,. - * - * @return void */ - function delete() { - + public function delete() + { foreach ($this->getChildren() as $child) { $this->deleteChild($child->getName()); } $this->parent->deleteChild($this->getName()); - } - } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php b/vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php index a624b6b6b..d48ddaa92 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php @@ -1,11 +1,13 @@ name = $name; $this->put($contents); $this->parent = $parent; - if ($lastModified === -1) { + if (-1 === $lastModified) { $lastModified = time(); } $this->lastModified = $lastModified; - } /** @@ -50,26 +50,23 @@ class File extends DAV\File { * * @return string */ - function getName() { - + public function getName() + { return $this->name; - } /** * Changes the name of the node. * * @param string $name - * @return void */ - function setName($name) { - + public function setName($name) + { $this->name = $name; - } /** - * Updates the data + * Updates the data. * * The data argument is a readable stream resource. * @@ -86,66 +83,59 @@ class File extends DAV\File { * return an ETag, and just return null. * * @param resource $data + * * @return string|null */ - function put($data) { - + public function put($data) + { if (is_resource($data)) { $data = stream_get_contents($data); } $this->contents = $data; - return '"' . md5($data) . '"'; + return '"'.md5($data).'"'; } /** - * Returns the data + * Returns the data. * * This method may either return a string or a readable stream resource * * @return mixed */ - function get() { - + public function get() + { return $this->contents; - } /** - * Returns the ETag for a file + * Returns the ETag for a file. * * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. * * Return null if the ETag can not effectively be determined - * - * @return void */ - function getETag() { - - return '"' . md5($this->contents) . '"'; - + public function getETag() + { + return '"'.md5($this->contents).'"'; } /** - * Returns the size of the node, in bytes + * Returns the size of the node, in bytes. * * @return int */ - function getSize() { - + public function getSize() + { return strlen($this->contents); - } /** - * Delete the node - * - * @return void + * Delete the node. */ - function delete() { - + public function delete() + { $this->parent->deleteChild($this->name); - } /** @@ -154,10 +144,8 @@ class File extends DAV\File { * * @return int */ - function getLastModified() { - + public function getLastModified() + { return $this->lastModified; - } - } -- cgit v1.2.3