Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
27 | 8 | public function __construct($fileName) |
|
28 | { |
||
29 | 8 | $this->fileName = $fileName; |
|
30 | 8 | if (is_dir($fileName)) { |
|
31 | 1 | throw new Downloader\TransportException( |
|
32 | 1 | "The file could not be written to $fileName. Directory exists." |
|
33 | 1 | ); |
|
34 | } |
||
35 | |||
36 | 7 | $this->createDir($fileName); |
|
37 | |||
38 | 6 | $this->fp = fopen($fileName, 'wb'); |
|
39 | 6 | if (!$this->fp) { |
|
40 | 1 | throw new Downloader\TransportException( |
|
41 | 1 | "The file could not be written to $fileName." |
|
42 | 1 | ); |
|
43 | } |
||
44 | 5 | } |
|
45 | |||
93 |