Completed
Push — v1.ns ( 31020d...499c60 )
by Timo
04:35 queued 01:07
created
examples/Cafe/lib/messaging/DrinkRouter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 class DrinkRouter 
4 4
 	extends PEIP_ABS_Router {
5 5
 	
6
-	protected function selectChannels(PEIP_INF_Message $message){
6
+	protected function selectChannels(PEIP_INF_Message $message) {
7 7
 		$order = $message->getContent();
8
-		$channelName = $order['iced']  ? 'coldDrinks' : 'hotDrinks';
8
+		$channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks';
9 9
 		echo PEIP_LINE_SEPARATOR."DrinkRouter: routed to channel: $channelName";
10 10
 		return $channelName;
11 11
 	}	
Please login to merge, or discard this patch.
examples/Cafe/lib/messaging/DrinkAggregator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 	protected $orders = array();
7 7
 	protected $preparedDrinks = array();
8 8
 	
9
-	public function __construct(PEIP_INF_Channel $inputChannel, PEIP_INF_Channel $outputChannel = NULL){
9
+	public function __construct(PEIP_INF_Channel $inputChannel, PEIP_INF_Channel $outputChannel = NULL) {
10 10
 		$this->setInputChannel($inputChannel);
11
-		if(is_object($outputChannel)){
11
+		if (is_object($outputChannel)) {
12 12
 			$this->setOutputChannel($outputChannel);	
13 13
 		}
14 14
 		$this->registerCommand('ADD_ORDER', array($this, 'receiveOrder'));
15 15
 	}
16 16
 
17
-	protected function doReply(PEIP_INF_Message $message){
17
+	protected function doReply(PEIP_INF_Message $message) {
18 18
 		$drink = $message->getContent();
19 19
 		$nr = $drink->getOrderNumber();
20
-		if(!isset($this->preparedDrinks[$nr])){
20
+		if (!isset($this->preparedDrinks[$nr])) {
21 21
 			$this->preparedDrinks[$nr] = array();
22 22
 		}
23 23
 		$this->preparedDrinks[$drink->getOrderNumber()][] = $drink;
24
-		if(isset($this->orders[$nr]) 
25
-			&& $this->orders[$nr]->getTotalCount() == count($this->preparedDrinks[$nr])){
24
+		if (isset($this->orders[$nr]) 
25
+			&& $this->orders[$nr]->getTotalCount() == count($this->preparedDrinks[$nr])) {
26 26
 			$this->replyMessage($this->preparedDrinks[$nr]);
27 27
 			unset($this->preparedDrinks[$nr]);
28 28
 			echo PEIP_LINE_SEPARATOR.'DrinkAggregator : reply #'.$nr;	
29 29
 		}
30 30
 	}
31 31
 
32
-	public function receiveOrder(Order $order){
32
+	public function receiveOrder(Order $order) {
33 33
 		echo PEIP_LINE_SEPARATOR.'DrinkAggregator: received Order';
34 34
 		$this->orders[$order->getOrderNumber()] = $order;	
35 35
 	}	
Please login to merge, or discard this patch.
examples/Cafe/lib/messaging/CafeGateway.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 class CafeGateway extends PEIP_Simple_Messaging_Gateway {
4 4
 
5
-	public function placeOrder(Order $order){
5
+	public function placeOrder(Order $order) {
6 6
 		echo "\nCafe: place order #".$order->getOrderNumber();
7 7
 		$this->send($order);
8 8
 	}
9 9
 	
10
-	public function receiveDelivery(){
10
+	public function receiveDelivery() {
11 11
 		return $this->receive();
12 12
 	}
13 13
 
Please login to merge, or discard this patch.
examples/Cafe/lib/messaging/OrderSplitter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 class OrderSplitter extends PEIP_ABS_Message_Splitter {
4 4
 
5
-	public function split(PEIP_INF_Message $message){
5
+	public function split(PEIP_INF_Message $message) {
6 6
 		$order = $message->getContent();
7 7
 		$orderItems = $order->getItems();
8 8
 		$items = array();
9
-		foreach($orderItems as $item){
9
+		foreach ($orderItems as $item) {
10 10
 			$nr = $item['number'];
11 11
 			unset($item['number']);
12 12
 			$item['order'] = $order->getOrderNumber();
13
-			for($x = 0; $x < $nr; $x++){
13
+			for ($x = 0; $x < $nr; $x++) {
14 14
 				$items[] = $item;	
15 15
 			}
16 16
 		}
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Barista.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@
 block discarded – undo
30 30
         return $this->prepareDrink($orderItem['order'], $orderItem['type'], true);
31 31
     }    
32 32
 	
33
-    protected function prepareDrink($orderNumber, $type, $iced){
33
+    protected function prepareDrink($orderNumber, $type, $iced) {
34 34
     	$drink = new Drink($orderNumber, $type, $iced);	
35 35
     	return $drink;
36 36
     }
37 37
 
38
-    protected function printAction($cold, $orderNr){
39
-    	if($cold){
38
+    protected function printAction($cold, $orderNr) {
39
+    	if ($cold) {
40 40
     		$type = 'cold';
41 41
     		$count = $this->coldDrinkCounter;
42
-    	}else{
42
+    	}else {
43 43
     		$type = 'hot';
44 44
     		$count = $this->hotDrinkCounter;    		
45 45
     	}
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Order.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 		$orderNumber;
8 8
 	protected static $orderCount = 0;
9 9
 
10
-	public function __construct(){
10
+	public function __construct() {
11 11
 		self::$orderCount++;
12 12
 		$this->orderNumber = self::$orderCount;
13 13
 	}	
14 14
 
15
-	public function getOrderNumber(){
15
+	public function getOrderNumber() {
16 16
 		return $this->orderNumber;
17 17
 	}
18 18
 	
19
-	public function addItem($type, $number, $iced = false){
19
+	public function addItem($type, $number, $iced = false) {
20 20
 		$this->items[] = 
21 21
 			array(
22 22
 				'type' => $type,
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 			);
26 26
 	}
27 27
 
28
-	public function getItems(){
28
+	public function getItems() {
29 29
 		return $this->items;
30 30
 	}
31 31
 
32
-	public function getTotalCount(){
32
+	public function getTotalCount() {
33 33
 		$x = 0;
34
-		foreach($this->items as $item){
34
+		foreach ($this->items as $item) {
35 35
 			$x += (int)$item['number'];
36 36
 		}
37 37
 		return $x;
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Delivery.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 		$deliveredDrinks,
7 7
 		$orderNumber;
8 8
 	
9
-	public function __construct(array $deliveredDrinks){
9
+	public function __construct(array $deliveredDrinks) {
10 10
 		$this->deliveredDrinks = $deliveredDrinks;
11 11
 		$this->orderNumber = $deliveredDrinks[0]->getOrderNumber();
12 12
 	}
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Drink.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@
 block discarded – undo
8 8
 		$type,
9 9
 		$iced;
10 10
 	
11
-	public function __construct($orderNumber, $type, $iced){
11
+	public function __construct($orderNumber, $type, $iced) {
12 12
 		$this->orderNumber = $orderNumber;
13 13
 		$this->type = $type;
14 14
 		$this->iced = $iced;
15 15
 	}
16 16
 
17
-	public function getType(){
17
+	public function getType() {
18 18
 		return $this->type; 
19 19
 	}
20 20
 
21
-	public function getIced(){
21
+	public function getIced() {
22 22
 		return $this->iced; 
23 23
 	}	
24 24
 
25
-	public function getOrderNumber(){
25
+	public function getOrderNumber() {
26 26
 		return $this->orderNumber;
27 27
 	}
28 28
 	
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Cafe.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 class Cafe 
4 4
 	extends PEIA_Simple_Messaging_Gateway {
5 5
 
6
-	public function placeOrder(Order $order){
6
+	public function placeOrder(Order $order) {
7 7
 		return $this->sendAndReceive($order);	
8 8
 	}
9 9
 
Please login to merge, or discard this patch.