TYPO3 API  SVNRelease
HeaderSet.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of SwiftMailer.
00005  * (c) 2004-2009 Chris Corbyn
00006  *
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00011 //@require 'Swift/Mime/CharsetObserver.php';
00012 
00013 /**
00014  * A collection of MIME headers.
00015  *
00016  * @package Swift
00017  * @subpackage Mime
00018  *
00019  * @author Chris Corbyn
00020  */
00021 interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
00022 {
00023 
00024   /**
00025    * Add a new Mailbox Header with a list of $addresses.
00026    *
00027    * @param string $name
00028    * @param array|string $addresses
00029    */
00030   public function addMailboxHeader($name, $addresses = null);
00031 
00032   /**
00033    * Add a new Date header using $timestamp (UNIX time).
00034    *
00035    * @param string $name
00036    * @param int $timestamp
00037    */
00038   public function addDateHeader($name, $timestamp = null);
00039 
00040   /**
00041    * Add a new basic text header with $name and $value.
00042    *
00043    * @param string $name
00044    * @param string $value
00045    */
00046   public function addTextHeader($name, $value = null);
00047 
00048   /**
00049    * Add a new ParameterizedHeader with $name, $value and $params.
00050    *
00051    * @param string $name
00052    * @param string $value
00053    * @param array $params
00054    */
00055   public function addParameterizedHeader($name, $value = null,
00056     $params = array());
00057 
00058   /**
00059    * Add a new ID header for Message-ID or Content-ID.
00060    *
00061    * @param string $name
00062    * @param string|array $ids
00063    */
00064   public function addIdHeader($name, $ids = null);
00065 
00066   /**
00067    * Add a new Path header with an address (path) in it.
00068    *
00069    * @param string $name
00070    * @param string $path
00071    */
00072   public function addPathHeader($name, $path = null);
00073 
00074   /**
00075    * Returns true if at least one header with the given $name exists.
00076    *
00077    * If multiple headers match, the actual one may be specified by $index.
00078    *
00079    * @param string $name
00080    * @param int $index
00081    *
00082    * @return boolean
00083    */
00084   public function has($name, $index = 0);
00085 
00086   /**
00087    * Set a header in the HeaderSet.
00088    *
00089    * The header may be a previously fetched header via {@link get()} or it may
00090    * be one that has been created separately.
00091    *
00092    * If $index is specified, the header will be inserted into the set at this
00093    * offset.
00094    *
00095    * @param Swift_Mime_Header $header
00096    * @param int $index
00097    */
00098   public function set(Swift_Mime_Header $header, $index = 0);
00099 
00100   /**
00101    * Get the header with the given $name.
00102    * If multiple headers match, the actual one may be specified by $index.
00103    * Returns NULL if none present.
00104    *
00105    * @param string $name
00106    * @param int $index
00107    *
00108    * @return Swift_Mime_Header
00109    */
00110   public function get($name, $index = 0);
00111 
00112   /**
00113    * Get all headers with the given $name.
00114    *
00115    * @param string $name
00116    *
00117    * @return array
00118    */
00119   public function getAll($name = null);
00120 
00121   /**
00122    * Remove the header with the given $name if it's set.
00123    *
00124    * If multiple headers match, the actual one may be specified by $index.
00125    *
00126    * @param string $name
00127    * @param int $index
00128    */
00129   public function remove($name, $index = 0);
00130 
00131   /**
00132    * Remove all headers with the given $name.
00133    *
00134    * @param string $name
00135    */
00136   public function removeAll($name);
00137 
00138   /**
00139    * Create a new instance of this HeaderSet.
00140    *
00141    * @return Swift_Mime_HeaderSet
00142    */
00143   public function newInstance();
00144 
00145   /**
00146    * Define a list of Header names as an array in the correct order.
00147    *
00148    * These Headers will be output in the given order where present.
00149    *
00150    * @param array $sequence
00151    */
00152   public function defineOrdering(array $sequence);
00153 
00154   /**
00155    * Set a list of header names which must always be displayed when set.
00156    *
00157    * Usually headers without a field value won't be output unless set here.
00158    *
00159    * @param array $names
00160    */
00161   public function setAlwaysDisplayed(array $names);
00162 
00163   /**
00164    * Returns a string with a representation of all headers.
00165    *
00166    * @return string
00167    */
00168   public function toString();
00169 
00170 }