XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
DateHeader.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of SwiftMailer.
5  * (c) 2004-2009 Chris Corbyn
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10 
11 //@require 'Swift/Mime/Headers/AbstractHeader.php';
12 
13 
21 {
22 
28  private $_timestamp;
29 
40  public function __construct($name)
41  {
42  $this->setFieldName($name);
43  }
44 
51  public function getFieldType()
52  {
53  return self::TYPE_DATE;
54  }
55 
61  public function setFieldBodyModel($model)
62  {
63  $this->setTimestamp($model);
64  }
65 
71  public function getFieldBodyModel()
72  {
73  return $this->getTimestamp();
74  }
75 
80  public function getTimestamp()
81  {
82  return $this->_timestamp;
83  }
84 
89  public function setTimestamp($timestamp)
90  {
91  if (!is_null($timestamp))
92  {
93  $timestamp = (int) $timestamp;
94  }
95  $this->clearCachedValueIf($this->_timestamp != $timestamp);
96  $this->_timestamp = $timestamp;
97  }
98 
106  public function getFieldBody()
107  {
108  if (!$this->getCachedValue())
109  {
110  if (isset($this->_timestamp))
111  {
112  $this->setCachedValue(date('r', $this->_timestamp));
113  }
114  }
115  return $this->getCachedValue();
116  }
117 
118 }