Conditions | 6 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function update(SplSubject $subject) |
||
19 | { |
||
20 | $event = $subject->getLastEvent(); |
||
21 | |||
22 | switch($event['name']) |
||
23 | { |
||
24 | case 'receivedHeaders': |
||
25 | $this->fp = @fopen($this->filename, 'wb'); |
||
26 | if(!$this->fp) |
||
27 | { |
||
28 | throw new Exception("Cannot open target file '{$filename}'"); |
||
29 | } |
||
30 | break; |
||
31 | |||
32 | case 'receivedBodyPart': |
||
33 | case 'receivedEncodedBodyPart': |
||
34 | fwrite($this->fp, $event['data']); |
||
35 | break; |
||
36 | |||
37 | case 'receivedBody': |
||
38 | fclose($this->fp); |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 |