1<?php 2 3namespace Sabre\DAV; 4 5/** 6 * File class 7 * 8 * This is a helper class, that should aid in getting file classes setup. 9 * Most of its methods are implemented, and throw permission denied exceptions 10 * 11 * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/). 12 * @author Evert Pot (http://evertpot.com/) 13 * @license http://sabre.io/license/ Modified BSD License 14 */ 15abstract class File extends Node implements IFile { 16 17 /** 18 * Updates the data 19 * 20 * data is a readable stream resource. 21 * 22 * @param resource $data 23 * @return void 24 */ 25 function put($data) { 26 27 throw new Exception\Forbidden('Permission denied to change data'); 28 29 } 30 31 /** 32 * Returns the data 33 * 34 * This method may either return a string or a readable stream resource 35 * 36 * @return mixed 37 */ 38 function get() { 39 40 throw new Exception\Forbidden('Permission denied to read this file'); 41 42 } 43 44 /** 45 * Returns the size of the file, in bytes. 46 * 47 * @return int 48 */ 49 function getSize() { 50 51 return 0; 52 53 } 54 55 /** 56 * Returns the ETag for a file 57 * 58 * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. 59 * The ETag is an arbitrary string, but MUST be surrounded by double-quotes. 60 * 61 * Return null if the ETag can not effectively be determined 62 * 63 * @return string|null 64 */ 65 function getETag() { 66 67 return null; 68 69 } 70 71 /** 72 * Returns the mime-type for a file 73 * 74 * If null is returned, we'll assume application/octet-stream 75 * 76 * @return string|null 77 */ 78 function getContentType() { 79 80 return null; 81 82 } 83 84} 85