commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / packages / ezc / Mail / src / parser / parts / multipart_alternative_parser.php
1 <?php
2 /**
3 * File containing the ezcMailMultipartAlternativeParser class
4 *
5 * @package Mail
6 * @version 1.7beta1
7 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
8 * @license http://ez.no/licenses/new_bsd New BSD License
9 */
10
11 /**
12 * Parses multipart/mixed mail parts.
13 *
14 * @package Mail
15 * @version 1.7beta1
16 * @access private
17 */
18 class ezcMailMultipartAlternativeParser extends ezcMailMultipartParser
19 {
20 /**
21 * Holds the ezcMailMultipartAlternative part corresponding to the data parsed with this parser.
22 *
23 * @var ezcMailMultipartAlternative
24 */
25 private $part = null;
26
27 /**
28 * Constructs a new ezcMailMultipartAlternativeParser.
29 *
30 * @param ezcMailHeadersHolder $headers
31 */
32 public function __construct( ezcMailHeadersHolder $headers )
33 {
34 parent::__construct( $headers );
35 $this->part = new ezcMailMultipartAlternative();
36 }
37
38 /**
39 * Adds the part $part to the list of multipart messages.
40 *
41 * This method is called automatically by ezcMailMultipartParser
42 * each time a part is parsed.
43 *
44 * @param ezcMailPart $part
45 */
46 public function partDone( ezcMailPart $part )
47 {
48 $this->part->appendPart( $part );
49 }
50
51 /**
52 * Returns the parts parsed for this multipart.
53 *
54 * @return ezcMailMultipartAlternative
55 */
56 public function finishMultipart()
57 {
58 $size = 0;
59 foreach ( $this->part->getParts() as $part )
60 {
61 $size += $part->size;
62 }
63 $this->part->size = $size;
64 return $this->part;
65 }
66 }
67
68 ?>