You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CacheEntry.php 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Robin Appelman <robin@icewind.nl>
  7. *
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OC\Files\Cache;
  24. use OCP\Files\Cache\ICacheEntry;
  25. /**
  26. * meta data for a file or folder
  27. */
  28. class CacheEntry implements ICacheEntry {
  29. /**
  30. * @var array
  31. */
  32. private $data;
  33. public function __construct(array $data) {
  34. $this->data = $data;
  35. }
  36. public function offsetSet($offset, $value) {
  37. $this->data[$offset] = $value;
  38. }
  39. public function offsetExists($offset) {
  40. return isset($this->data[$offset]);
  41. }
  42. public function offsetUnset($offset) {
  43. unset($this->data[$offset]);
  44. }
  45. public function offsetGet($offset) {
  46. if (isset($this->data[$offset])) {
  47. return $this->data[$offset];
  48. } else {
  49. return null;
  50. }
  51. }
  52. public function getId() {
  53. return (int)$this->data['fileid'];
  54. }
  55. public function getStorageId() {
  56. return $this->data['storage'];
  57. }
  58. public function getPath() {
  59. return (string)$this->data['path'];
  60. }
  61. public function getName() {
  62. return $this->data['name'];
  63. }
  64. public function getMimeType() {
  65. return $this->data['mimetype'];
  66. }
  67. public function getMimePart() {
  68. return $this->data['mimepart'];
  69. }
  70. public function getSize() {
  71. return $this->data['size'];
  72. }
  73. public function getMTime() {
  74. return $this->data['mtime'];
  75. }
  76. public function getStorageMTime() {
  77. return $this->data['storage_mtime'];
  78. }
  79. public function getEtag() {
  80. return $this->data['etag'];
  81. }
  82. public function getPermissions() {
  83. return $this->data['permissions'];
  84. }
  85. public function isEncrypted() {
  86. return isset($this->data['encrypted']) && $this->data['encrypted'];
  87. }
  88. public function getMetadataEtag(): ?string {
  89. return $this->data['metadata_etag'];
  90. }
  91. public function getCreationTime(): ?int {
  92. return $this->data['creation_time'];
  93. }
  94. public function getUploadTime(): ?int {
  95. return $this->data['upload_time'];
  96. }
  97. public function getData() {
  98. return $this->data;
  99. }
  100. }