File indexing completed on 2024-09-22 05:16:57

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Mail
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 
0023 /**
0024  * Zend_Mail_Part
0025  */
0026 // require_once 'Zend/Mail/Part/File.php';
0027 
0028 /**
0029  * Zend_Mail_Message_Interface
0030  */
0031 // require_once 'Zend/Mail/Message/Interface.php';
0032 
0033 /**
0034  * @category   Zend
0035  * @package    Zend_Mail
0036  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0037  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0038  */
0039 class Zend_Mail_Message_File extends Zend_Mail_Part_File implements Zend_Mail_Message_Interface
0040 {
0041     /**
0042      * flags for this message
0043      * @var array
0044      */
0045     protected $_flags = array();
0046 
0047     /**
0048      * Public constructor
0049      *
0050      * In addition to the parameters of Zend_Mail_Part::__construct() this constructor supports:
0051      * - flags array with flags for message, keys are ignored, use constants defined in Zend_Mail_Storage
0052      *
0053      * @param  string $rawMessage  full message with or without headers
0054      * @throws Zend_Mail_Exception
0055      */
0056     public function __construct(array $params)
0057     {
0058         if (!empty($params['flags'])) {
0059             // set key and value to the same value for easy lookup
0060             $this->_flags = array_combine($params['flags'], $params['flags']);
0061         }
0062 
0063         parent::__construct($params);
0064     }
0065 
0066     /**
0067      * return toplines as found after headers
0068      *
0069      * @return string toplines
0070      */
0071     public function getTopLines()
0072     {
0073         return $this->_topLines;
0074     }
0075 
0076     /**
0077      * check if flag is set
0078      *
0079      * @param mixed $flag a flag name, use constants defined in Zend_Mail_Storage
0080      * @return bool true if set, otherwise false
0081      */
0082     public function hasFlag($flag)
0083     {
0084         return isset($this->_flags[$flag]);
0085     }
0086 
0087     /**
0088      * get all set flags
0089      *
0090      * @return array array with flags, key and value are the same for easy lookup
0091      */
0092     public function getFlags()
0093     {
0094         return $this->_flags;
0095     }
0096 }