AbstractCacheEvent.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl>
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\Files\Cache;
  27. use OCP\EventDispatcher\Event;
  28. use OCP\Files\Storage\IStorage;
  29. /**
  30. * @since 22.0.0
  31. */
  32. class AbstractCacheEvent extends Event implements ICacheEvent {
  33. protected $storage;
  34. protected $path;
  35. protected $fileId;
  36. protected $storageId;
  37. /**
  38. * @param IStorage $storage
  39. * @param string $path
  40. * @param int $fileId
  41. * @since 22.0.0
  42. */
  43. public function __construct(IStorage $storage, string $path, int $fileId, int $storageId) {
  44. $this->storage = $storage;
  45. $this->path = $path;
  46. $this->fileId = $fileId;
  47. $this->storageId = $storageId;
  48. }
  49. /**
  50. * @return IStorage
  51. * @since 22.0.0
  52. */
  53. public function getStorage(): IStorage {
  54. return $this->storage;
  55. }
  56. /**
  57. * @return string
  58. * @since 22.0.0
  59. */
  60. public function getPath(): string {
  61. return $this->path;
  62. }
  63. /**
  64. * @param string $path
  65. * @since 22.0.0
  66. */
  67. public function setPath(string $path): void {
  68. $this->path = $path;
  69. }
  70. /**
  71. * @return int
  72. * @since 22.0.0
  73. */
  74. public function getFileId(): int {
  75. return $this->fileId;
  76. }
  77. /**
  78. * @return int
  79. * @since 22.0.0
  80. */
  81. public function getStorageId(): int {
  82. return $this->storageId;
  83. }
  84. }