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.3KB

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