| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4.074 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 45 | 40 | public static function getTempBaseDir() |
|
| 46 | 40 | { |
|
| 47 | 40 | $dirs = self::$tempDirs; |
|
| 48 | 40 | // Fallback to sys temp dir |
|
| 49 | $dirs[] = sys_get_temp_dir(); |
||
| 50 | 40 | ||
| 51 | foreach ($dirs as $directory) { |
||
| 52 | if (file_exists($directory)) { |
||
| 53 | $baseDir = $directory . DIRECTORY_SEPARATOR . 'paraunit'; |
||
| 54 | |||
| 55 | try { |
||
| 56 | self::mkdirIfNotExists($baseDir); |
||
| 57 | |||
| 58 | return $baseDir; |
||
| 59 | } catch (\RuntimeException $e) { |
||
| 60 | 40 | // ignore and try next dir |
|
| 61 | } |
||
| 62 | 40 | } |
|
| 63 | 40 | } |
|
| 64 | 40 | ||
| 65 | 40 | throw new \RuntimeException('Unable to create a temporary directory'); |
|
| 66 | } |
||
| 67 | |||
| 86 |