Conditions | 3 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.3332 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
28 | 1 | public function createRelative($directory, $target, $link) |
|
29 | { |
||
30 | 1 | if (!is_dir($directory)) { |
|
31 | $this->error("Directory '$directory' not found."); |
||
32 | } |
||
33 | 1 | $cmd = 'cd ' . escapeshellarg($directory) . ' && ln -s ' . escapeshellarg($target) . ' ' . escapeshellarg($link); |
|
34 | 1 | $command = new Commands\Exec(); |
|
35 | 1 | $command->setCommand($cmd); |
|
36 | 1 | $result = $command->execute(); |
|
37 | 1 | if ($result->getResult() !== 0) { |
|
38 | $this->error("Cannot create symlink '$target' - '$link' in directory '$directory'."); |
||
39 | } |
||
40 | 1 | return $result; |
|
41 | } |
||
42 | |||
43 | } |