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 00023 class PEIP_Command_Message 00024 extends PEIP_Generic_Message 00025 implements PEIP_INF_Command { 00026 00027 00028 00035 public function __construct($content, ArrayAccess $headers = NULL){ 00036 if(!($content instanceof PEIP_INF_Command) && !is_callable($content)){ 00037 throw new BadArgumentException('Argument 1 for PEIP_Command_Message::__construct must be callable or implment PEIP_INF_Command'); 00038 } 00039 00040 00041 parent::__construct($content, $headers); 00042 } 00043 00044 00049 public function execute(){ 00050 if(is_callable($this->getContent())){ 00051 return call_user_func($this->getContent()); 00052 }else{ 00053 return $this->getContent()->execute(); 00054 } 00055 } 00056 00057 }