Changeset 919
- Timestamp:
- 09/15/07 16:24:52 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/org/simpletest/extensions/streamwrapper/file.php
r918 r919 53 53 54 54 /** 55 * checks whether the container can be applied to given name 56 * 57 * @param string $name 58 * @return bool 59 */ 60 public function appliesTo($name) 61 { 62 return ($name === $this->name); 63 } 64 65 /** 55 66 * sets the contents of the file 56 67 * … … 60 71 { 61 72 $this->content = $content; 73 } 74 75 /** 76 * returns the contents of the file 77 * 78 * @return string 79 */ 80 public function getContent() 81 { 82 return $this->content; 62 83 } 63 84 … … 76 97 77 98 /** 99 * returns the content until its end from current offset 100 * 101 * @return string 102 */ 103 public function readUntilEnd() 104 { 105 return substr($this->content, $this->bytes_read); 106 } 107 108 /** 78 109 * writes an amount of data 79 110 * … … 83 114 public function write($data) 84 115 { 85 // write data to content 86 return 0; 116 $dataLen = strlen($data); 117 $this->content = substr($this->content, 0, $this->bytes_read) . $data . substr($this->content, $this->bytes_read + $dataLen); 118 $this->bytes_read += $dataLen; 119 return $dataLen; 87 120 } 88 121
