diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php | 84 |
1 files changed, 36 insertions, 48 deletions
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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Mock; use Sabre\DAV; /** - * Mock File + * Mock File. * * See the Collection in this directory for more details. * @@ -13,34 +15,32 @@ use Sabre\DAV; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class File extends DAV\File { - +class File extends DAV\File +{ protected $name; protected $contents; protected $parent; protected $lastModified; /** - * Creates the object + * Creates the object. * - * @param string $name - * @param resource $contents + * @param string $name + * @param resource $contents * @param Collection $parent - * @param int $lastModified - * @return void + * @param int $lastModified */ - function __construct($name, $contents, Collection $parent = null, $lastModified = -1) { - + public function __construct($name, $contents, Collection $parent = null, $lastModified = -1) + { $this->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; - } - } |