@@ 169-176 (lines=8) @@ | ||
166 | * @return $this |
|
167 | * @throws \NeedleProject\FileIo\Exception\PermissionDeniedException |
|
168 | */ |
|
169 | public function appendContent(string $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(string $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 |