Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 5.4042 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | 9 | public function isDirectoryWritable(string $directory): bool |
|
28 | { |
||
29 | try { |
||
30 | 9 | $jFile = $this->ba->java('java.io.File', $directory); |
|
31 | } catch (JavaException $e) { |
||
32 | throw $e; |
||
33 | } |
||
34 | |||
35 | 9 | if (!$jFile->exists()) { |
|
36 | throw new Exception\InvalidDirectoryException(sprintf('Directory \'%s\' does not exists (jvm-side)', $directory)); |
||
37 | } |
||
38 | |||
39 | 9 | if (!$jFile->isDirectory()) { |
|
40 | throw new Exception\InvalidDirectoryException(sprintf('Path \'%s\' is not a directory (jvm-side)', $directory)); |
||
41 | } |
||
42 | |||
43 | 9 | return $jFile->canWrite(); |
|
44 | } |
||
46 |