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_Priority_Channel 00024 extends PEIP_Queue_Channel { 00025 00026 protected $priorityHeader = 'PRIORITY'; 00027 00028 00035 public function __construct($capacity = -1, $priorityHeader = NULL){ 00036 $this->setCapacity((int)$capacity); 00037 $this->queue = new SplPriorityQueue(); 00038 if($priorityHeader){ 00039 $this->priorityHeader = $priorityHeader; 00040 } 00041 } 00042 00043 00049 protected function doSend(PEIP_INF_Message $message){ 00050 if($this->capacity < 1 || $this->getMessageCount() <= $this->getCapacity()){ 00051 $this->queue->insert($message, $message->getHeader($this->priorityHeader)); 00052 }else{ 00053 throw new Exception('Not implemented yet.'); 00054 } 00055 } 00056 }