@@ 169-176 (lines=8) @@ | ||
166 | * @return $this |
|
167 | * @throws \NeedleProject\FileIo\Exception\PermissionDeniedException |
|
168 | */ |
|
169 | public function appendContent($content) |
|
170 | { |
|
171 | if ($this->isWritable() === false) { |
|
172 | throw new PermissionDeniedException("The current file is not writable!"); |
|
173 | } |
|
174 | file_put_contents($this->filenameWithPath, $content, FILE_APPEND); |
|
175 | return $this; |
|
176 | } |
|
177 | ||
178 | /** |
|
179 | * Add content to the begging of the file |
|
@@ 184-191 (lines=8) @@ | ||
181 | * @return $this |
|
182 | * @throws \NeedleProject\FileIo\Exception\PermissionDeniedException |
|
183 | */ |
|
184 | public function prependContent($content) |
|
185 | { |
|
186 | if ($this->isWritable() === false) { |
|
187 | throw new PermissionDeniedException("The current file is not writable!"); |
|
188 | } |
|
189 | file_put_contents($this->filenameWithPath, $content . $this->getContent()->get()); |
|
190 | return $this; |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * Deletes the current file |
|
@@ 126-133 (lines=8) @@ | ||
123 | * @return \NeedleProject\FileIo\File |
|
124 | * @throws \NeedleProject\FileIo\Exception\PermissionDeniedException |
|
125 | */ |
|
126 | public function write(ContentInterface $content) |
|
127 | { |
|
128 | if ($this->isWritable() === false) { |
|
129 | throw new PermissionDeniedException("The current file is not writable!"); |
|
130 | } |
|
131 | file_put_contents($this->filenameWithPath, $content->get()); |
|
132 | return $this; |
|
133 | } |
|
134 | ||
135 | /** |
|
136 | * @return \NeedleProject\FileIo\Content\ContentInterface |