Conditions | 6 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | protected function createSavePath(string $savePath, string $sessionName) : string |
||
32 | { |
||
33 | $savePathParts = explode(DIRECTORY_SEPARATOR, rtrim($savePath, DIRECTORY_SEPARATOR)); |
||
34 | if ($sessionName !== Configuration::SESSION_NAME_DEFAULT && $sessionName !== array_pop($savePathParts)) { |
||
35 | $savePath .= DIRECTORY_SEPARATOR . $sessionName; |
||
36 | } |
||
37 | |||
38 | if (!is_dir($savePath) && !@mkdir($savePath, 0777, true) && !is_dir($savePath)) { |
||
39 | // @codeCoverageIgnoreStart |
||
40 | throw new \RuntimeException( |
||
41 | sprintf('Failed to create session save path "%s", directory might be write protected', $savePath) |
||
42 | ); |
||
43 | // @codeCoverageIgnoreEnd |
||
44 | } |
||
45 | |||
46 | return $savePath; |
||
47 | } |
||
48 | } |
||
49 |