| 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 | 4 | public function __construct($fileName) | |
| 28 |     { | ||
| 29 | 4 | $this->fileName = $fileName; | |
| 30 | 4 |         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 | 3 | $this->createDir($fileName); | |
| 37 | |||
| 38 | 2 | $this->fp = fopen($fileName, 'wb'); | |
| 39 | 2 |         if (!$this->fp) { | |
| 40 | 1 | throw new Downloader\TransportException( | |
| 41 | 1 | "The file could not be written to $fileName." | |
| 42 | 1 | ); | |
| 43 | } | ||
| 44 | 1 | } | |
| 45 | |||
| 93 |