Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Tequilarapido\Cli; |
||
8 | public function checkDirectory($dir) |
||
9 | { |
||
10 | // Check if it's not empty |
||
11 | if (empty($dir)) { |
||
12 | throw new \LogicException("Empty given directory."); |
||
13 | } |
||
14 | |||
15 | // Check if it exists and it is writable |
||
16 | $directory = $this->getDirFullPath($dir); |
||
17 | if (!$directory) { |
||
18 | throw new \LogicException("Directory not found (Given:" . $dir . ")."); |
||
19 | } |
||
20 | |||
21 | return $directory; |
||
22 | } |
||
23 | |||
50 | } |