File.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * File class
  4. *
  5. * This is a helper class, that should aid in getting file classes setup.
  6. * Most of its methods are implemented, and throw permission denied exceptions
  7. *
  8. * @package Sabre
  9. * @subpackage DAV
  10. * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
  11. * @author Evert Pot (http://www.rooftopsolutions.nl/)
  12. * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  13. */
  14. abstract class Sabre_DAV_File extends Sabre_DAV_Node implements Sabre_DAV_IFile {
  15. /**
  16. * Updates the data
  17. *
  18. * data is a readable stream resource.
  19. *
  20. * @param resource $data
  21. * @return void
  22. */
  23. public function put($data) {
  24. throw new Sabre_DAV_Exception_Forbidden('Permission denied to change data');
  25. }
  26. /**
  27. * Returns the data
  28. *
  29. * This method may either return a string or a readable stream resource
  30. *
  31. * @return mixed
  32. */
  33. public function get() {
  34. throw new Sabre_DAV_Exception_Forbidden('Permission denied to read this file');
  35. }
  36. /**
  37. * Returns the size of the file, in bytes.
  38. *
  39. * @return int
  40. */
  41. public function getSize() {
  42. return 0;
  43. }
  44. /**
  45. * Returns the ETag for a file
  46. *
  47. * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
  48. * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
  49. *
  50. * Return null if the ETag can not effectively be determined
  51. *
  52. * @return string|null
  53. */
  54. public function getETag() {
  55. return null;
  56. }
  57. /**
  58. * Returns the mime-type for a file
  59. *
  60. * If null is returned, we'll assume application/octet-stream
  61. *
  62. * @return string|null
  63. */
  64. public function getContentType() {
  65. return null;
  66. }
  67. }