summaryrefslogtreecommitdiffstats
path: root/lib/private/files/fileinfo.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/fileinfo.php')
-rw-r--r--lib/private/files/fileinfo.php149
1 files changed, 149 insertions, 0 deletions
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
new file mode 100644
index 00000000000..24d99627aaf
--- /dev/null
+++ b/lib/private/files/fileinfo.php
@@ -0,0 +1,149 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files;
+
+class FileInfo implements \OCP\Files\FileInfo {
+ /**
+ * @var array $data
+ */
+ private $data;
+
+ /**
+ * @var string $path
+ */
+ private $path;
+
+ /**
+ * @var \OC\Files\Storage\Storage $storage
+ */
+ private $storage;
+
+ /**
+ * @var string $internalPath
+ */
+ private $internalPath;
+
+ public function __construct($path, $storage, $internalPath, $data) {
+ $this->path = $path;
+ $this->storage = $storage;
+ $this->internalPath = $internalPath;
+ $this->data = $data;
+ }
+
+ public function offsetSet($offset, $value) {
+ $this->data[$offset] = $value;
+ }
+
+ public function offsetExists($offset) {
+ return isset($this->data[$offset]);
+ }
+
+ public function offsetUnset($offset) {
+ unset($this->data[$offset]);
+ }
+
+ public function offsetGet($offset) {
+ return $this->data[$offset];
+ }
+
+ public function jsonSerialize() {
+ return $this->data;
+ }
+
+ /**
+ * @return string
+ */
+ public function getPath() {
+ return $this->path;
+ }
+
+ /**
+ * @return \OCP\Files\Storage
+ */
+ public function getStorage() {
+ return $this->storage;
+ }
+
+ /**
+ * @return string
+ */
+ public function getInternalPath() {
+ return $this->internalPath;
+ }
+
+ /**
+ * @return int
+ */
+ public function getId() {
+ return $this->data['fileid'];
+ }
+
+ /**
+ * @return string
+ */
+ public function getMimetype() {
+ return $this->data['mimetype'];
+ }
+
+ /**
+ * @return string
+ */
+ public function getMimePart() {
+ return $this->data['mimepart'];
+ }
+
+ /**
+ * @return string
+ */
+ public function getName() {
+ return $this->data['name'];
+ }
+
+ /**
+ * @return string
+ */
+ public function getEtag() {
+ return $this->data['etag'];
+ }
+
+ /**
+ * @return int
+ */
+ public function getSize() {
+ return $this->data['size'];
+ }
+
+ /**
+ * @return int
+ */
+ public function getMtime() {
+ return $this->data['mtime'];
+ }
+
+ /**
+ * @return bool
+ */
+ public function isEncrypted() {
+ return $this->data['encrypted'];
+ }
+
+ /**
+ * @return int
+ */
+ public function getPermissions() {
+ return $this->data['permissions'];
+ }
+
+ /**
+ * @return \OCP\Files\FileInfo::TYPE_FILE | \OCP\Files\FileInfo::TYPE_FOLDER
+ */
+ public function getType() {
+ return $this->data['type'];
+ }
+}