Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
70 | 7 | protected function createDir($fileName) |
|
71 | { |
||
72 | 7 | $dir = $fileName; |
|
73 | 7 | $createdDirs = array(); |
|
74 | do { |
||
75 | 7 | $dir = dirname($dir); |
|
76 | 7 | $createdDirs[] = $dir; |
|
77 | 7 | } while (!file_exists($dir)); |
|
78 | 7 | array_pop($createdDirs); |
|
79 | 7 | $this->createdDirs = array_reverse($createdDirs); |
|
80 | |||
81 | 7 | $targetdir = dirname($fileName); |
|
82 | 7 | if (!file_exists($targetdir)) { |
|
83 | 6 | $created = mkdir($targetdir, 0766, true); |
|
84 | 6 | if (!$created) { |
|
85 | 1 | $this->success = false; |
|
86 | 1 | throw new Downloader\TransportException( |
|
87 | 1 | "The file could not be written to $this->fileName." |
|
88 | 1 | ); |
|
89 | } |
||
90 | 5 | } |
|
91 | 6 | } |
|
92 | } |
||
93 |