forked from iangreenleaf/Scisr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateFile.php
More file actions
36 lines (28 loc) · 872 Bytes
/
CreateFile.php
File metadata and controls
36 lines (28 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Creates a file.
* Todo: Create abstract baseclass for both file classes
* Author: Tarjei Huse (tarjei@scanmine.com) http://www.kraken.no
*/
class Scisr_CreateFile extends Scisr_File {
public function __construct($filename, $content)
{
$this->content = $content;
$this->filename = $filename;
}
public function process($mode)
{
if ($mode != ScisrRunner::MODE_AGGRESSIVE && file_exists($this->filename)) {
throw new RuntimeException("Cannot overwrite {$this->filename} in timid mode!");
}
file_put_contents($this->filename, $this->content);
}
public function addEdit($line, $column, $length, $replacement, $tentative)
{
throw new Exception("Unsupported!");
}
public function rename($newName)
{
throw new Exception("Unsupported!");
}
}