Conditions | 5 |
Paths | 12 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 10.3999 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | 1 | public function create($file, $contents = NULL, $chmod = NULL) |
|
15 | { |
||
16 | 1 | if (is_file($file)) { |
|
17 | $this->error("File '$file' already exists."); |
||
18 | } |
||
19 | 1 | $result = file_put_contents($file, $contents); |
|
20 | 1 | if (!$result) { |
|
21 | $this->error("Cannot create file '$file'."); |
||
22 | } |
||
23 | 1 | if ($chmod !== NULL) { |
|
24 | $result = chmod($file, $chmod); |
||
25 | if (!$result) { |
||
26 | $this->error("Cannot chmod file '$file'."); |
||
27 | } |
||
28 | } |
||
29 | 1 | } |
|
30 | |||
67 | } |