| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 68 | public function write($file) |
||
| 69 | { |
||
| 70 | if (!is_writable(dirname($file))) { |
||
| 71 | throw new RuntimeException("Could not write!"); |
||
| 72 | } |
||
| 73 | |||
| 74 | $content = ""; |
||
| 75 | |||
| 76 | foreach ($this->data as $k => $v) { |
||
| 77 | foreach ($this->map as $field => $length) { |
||
| 78 | $content .= str_pad($v[$field], $length, " ", STR_PAD_RIGHT); |
||
| 79 | } |
||
| 80 | $content .= "\n"; |
||
| 81 | } |
||
| 82 | |||
| 83 | $fp = fopen($file, 'w+'); |
||
| 84 | fputs($fp, $content); |
||
| 85 | fclose($fp); |
||
| 86 | |||
| 87 | return true; |
||
| 88 | } |
||
| 89 | } |
||
| 90 |