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