00001 <?php 00002 00003 /* 00004 * This file is part of the PEIP package. 00005 * (c) 2010 Timo Michna <timomichna/yahoo.de> 00006 * 00007 * For the full copyright and license information, please view the LICENSE 00008 * file that was distributed with this source code. 00009 */ 00010 00021 class PEIP_Generic_Message 00022 extends PEIP_ABS_Container 00023 implements 00024 PEIP_INF_Message, 00025 PEIP_INF_Buildable { 00026 00027 protected $payload; 00028 00029 protected $headers; 00030 00031 00038 public function __construct($content, ArrayAccess $headers = NULL){ 00039 $this->doSetContent($content); 00040 if($headers){ 00041 $this->headers = $headers; 00042 } 00043 } 00044 00045 00051 protected function doSetContent($content){ 00052 $this->content = $content; 00053 } 00054 00055 00066 public function getHeaders(){ 00067 return $this->headers; 00068 } 00069 00070 00076 public function getHeader($name){ 00077 return $this->headers[$name]; 00078 } 00079 00080 00086 public function hasHeader($name){ 00087 return (bool)$this->headers[$name]; 00088 } 00089 00090 public static function build(array $arguments = array()){ 00091 return PEIP_Generic_Builder::getInstance('PEIP_Generic_Message')->build($arguments); 00092 } 00093 00094 }