Completed
Push — v1.ns ( 6f2676...0f96a8 )
by Timo
03:42
created
src/Factory/ServiceFactory.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
  *
12 12
  * @author timo
13 13
  */
14
-use PEIP\Util\Test;
15
-use PEIP\Base\GenericBuilder;
14
+use PEIP\Util\Test;
15
+use PEIP\Base\GenericBuilder;
16 16
 use PEIP\Context\XMLContext;
17 17
 
18 18
 class ServiceFactory {
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 use PEIP\Context\XMLContext;
17 17
 
18 18
 class ServiceFactory {
19
-     /**
20
-     * Creates and initializes service instance from a given configuration.
21
-     *
22
-     * @access public
23
-     * @param $config configuration of the service
24
-     * @return object the initialized service instance
25
-     */
19
+        /**
20
+         * Creates and initializes service instance from a given configuration.
21
+         *
22
+         * @access public
23
+         * @param $config configuration of the service
24
+         * @return object the initialized service instance
25
+         */
26 26
     public static function createService(array $config){
27 27
         $args = array();
28 28
         //build arguments for constructor
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
     }
36 36
 
37 37
         /**
38
-     * Builds an arbitrary service/object instance from a config-obect.
39
-     *
40
-     * @static
41
-     * @access protected
42
-     * @param object $config configuration object to build a service instance from.
43
-     * @param array $arguments arguments for the service constructor
44
-     * @param string $defaultClass class to create instance for if none is set in config
45
-     * @return object build and modified srvice instance
46
-     */
38
+         * Builds an arbitrary service/object instance from a config-obect.
39
+         *
40
+         * @static
41
+         * @access protected
42
+         * @param object $config configuration object to build a service instance from.
43
+         * @param array $arguments arguments for the service constructor
44
+         * @param string $defaultClass class to create instance for if none is set in config
45
+         * @return object build and modified srvice instance
46
+         */
47 47
     public static function doBuild($config, $arguments, $defaultClass = false){
48 48
         $cls = isset($config["class"]) ? trim((string)$config["class"]) : (string)$defaultClass;
49 49
         if($cls != ''){
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
     }
81 81
 
82 82
         /**
83
-     * Builds single argument (to call a method with later) from a config-obect.
84
-     *
85
-     * @access protected
86
-     * @param object $config configuration object to create argument from.
87
-     * @return mixed build argument
88
-     */
83
+         * Builds single argument (to call a method with later) from a config-obect.
84
+         *
85
+         * @access protected
86
+         * @param object $config configuration object to create argument from.
87
+         * @return mixed build argument
88
+         */
89 89
     protected function buildArg($config){
90 90
         if(trim((string)$config['value']) != ''){
91 91
             $arg = (string)$config['value'];
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public static function buildAndModify(array $config, $arguments, $defaultClass = ""){
130 130
         if((isset($config["class"]) && "" != (string)$config["class"])  || $defaultClass !== ""){
131
-             $service = ServiceFactory::doBuild($config, $arguments, $defaultClass);
131
+                $service = ServiceFactory::doBuild($config, $arguments, $defaultClass);
132 132
         }else{
133 133
             throw new \RuntimeException('Could not create Service. no class or reference given.');
134 134
         }
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Barista.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
31 31
     }    
32 32
 	
33 33
     protected function prepareDrink($orderNumber, $type, $iced){
34
-    	$drink = new Drink($orderNumber, $type, $iced);	
35
-    	return $drink;
34
+        $drink = new Drink($orderNumber, $type, $iced);	
35
+        return $drink;
36 36
     }
37 37
 
38 38
     protected function printAction($cold, $orderNr){
39
-    	if($cold){
40
-    		$type = 'cold';
41
-    		$count = $this->coldDrinkCounter;
42
-    	}else{
43
-    		$type = 'hot';
44
-    		$count = $this->hotDrinkCounter;    		
45
-    	}
46
-    	$total = $this->coldDrinkCounter + $this->hotDrinkCounter;
39
+        if($cold){
40
+            $type = 'cold';
41
+            $count = $this->coldDrinkCounter;
42
+        }else{
43
+            $type = 'hot';
44
+            $count = $this->hotDrinkCounter;    		
45
+        }
46
+        $total = $this->coldDrinkCounter + $this->hotDrinkCounter;
47 47
         echo PEIP_LINE_SEPARATOR."Barista: prepared $type drink (total #$total- $type #$count) for order #$orderNr";
48 48
         flush();    
49 49
     }
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Order.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -2,40 +2,40 @@
 block discarded – undo
2 2
 
3 3
 class Order {
4 4
 
5
-	protected 
6
-		$items = array(),
7
-		$orderNumber;
8
-	protected static $orderCount = 0;
5
+    protected 
6
+        $items = array(),
7
+        $orderNumber;
8
+    protected static $orderCount = 0;
9 9
 
10
-	public function __construct(){
11
-		self::$orderCount++;
12
-		$this->orderNumber = self::$orderCount;
13
-	}	
10
+    public function __construct(){
11
+        self::$orderCount++;
12
+        $this->orderNumber = self::$orderCount;
13
+    }	
14 14
 
15
-	public function getOrderNumber(){
16
-		return $this->orderNumber;
17
-	}
15
+    public function getOrderNumber(){
16
+        return $this->orderNumber;
17
+    }
18 18
 	
19
-	public function addItem($type, $number, $iced = false){
20
-		$this->items[] = 
21
-			array(
22
-				'type' => $type,
23
-				'number' => $number,
24
-				'iced' => $iced
25
-			);
26
-	}
19
+    public function addItem($type, $number, $iced = false){
20
+        $this->items[] = 
21
+            array(
22
+                'type' => $type,
23
+                'number' => $number,
24
+                'iced' => $iced
25
+            );
26
+    }
27 27
 
28
-	public function getItems(){
29
-		return $this->items;
30
-	}
28
+    public function getItems(){
29
+        return $this->items;
30
+    }
31 31
 
32
-	public function getTotalCount(){
33
-		$x = 0;
34
-		foreach($this->items as $item){
35
-			$x += (int)$item['number'];
36
-		}
37
-		return $x;
38
-	}
32
+    public function getTotalCount(){
33
+        $x = 0;
34
+        foreach($this->items as $item){
35
+            $x += (int)$item['number'];
36
+        }
37
+        return $x;
38
+    }
39 39
 	
40 40
 	
41 41
 	
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Delivery.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
 
3 3
 class Delivery {
4 4
 
5
-	protected 
6
-		$deliveredDrinks,
7
-		$orderNumber;
5
+    protected 
6
+        $deliveredDrinks,
7
+        $orderNumber;
8 8
 	
9
-	public function __construct(array $deliveredDrinks){
10
-		$this->deliveredDrinks = $deliveredDrinks;
11
-		$this->orderNumber = $deliveredDrinks[0]->getOrderNumber();
12
-	}
9
+    public function __construct(array $deliveredDrinks){
10
+        $this->deliveredDrinks = $deliveredDrinks;
11
+        $this->orderNumber = $deliveredDrinks[0]->getOrderNumber();
12
+    }
13 13
 
14 14
 
15 15
 
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Drink.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -3,30 +3,30 @@
 block discarded – undo
3 3
 
4 4
 class Drink {
5 5
 
6
-	protected 
7
-		$orderNumber,
8
-		$type,
9
-		$iced;
6
+    protected 
7
+        $orderNumber,
8
+        $type,
9
+        $iced;
10 10
 	
11
-	public function __construct($orderNumber, $type, $iced){
12
-		$this->orderNumber = $orderNumber;
13
-		$this->type = $type;
14
-		$this->iced = $iced;
15
-	}
11
+    public function __construct($orderNumber, $type, $iced){
12
+        $this->orderNumber = $orderNumber;
13
+        $this->type = $type;
14
+        $this->iced = $iced;
15
+    }
16 16
 
17
-	public function getType(){
18
-		return $this->type; 
19
-	}
17
+    public function getType(){
18
+        return $this->type; 
19
+    }
20 20
 
21
-	public function getIced(){
22
-		return $this->iced; 
23
-	}	
21
+    public function getIced(){
22
+        return $this->iced; 
23
+    }	
24 24
 
25
-	public function getOrderNumber(){
26
-		return $this->orderNumber;
27
-	}
25
+    public function getOrderNumber(){
26
+        return $this->orderNumber;
27
+    }
28 28
 	
29
-	public function __sleep()
29
+    public function __sleep()
30 30
     {
31 31
         return array('orderNumber', 'type', 'iced');
32 32
     }
Please login to merge, or discard this patch.
examples/Cafe/lib/model/DrinkType.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 
3 3
 class DrinkType {
4 4
 
5
-	const 
6
-		ESPRESSO = 'ESPRESSO',
7
-		LATTE = 'LATTE',
8
-		CAPPUCCINO = 'CAPPUCCINO',
9
-		MOCCA = 'MOCCA'; 
5
+    const 
6
+        ESPRESSO = 'ESPRESSO',
7
+        LATTE = 'LATTE',
8
+        CAPPUCCINO = 'CAPPUCCINO',
9
+        MOCCA = 'MOCCA'; 
10 10
 
11 11
 }
12 12
 
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Waiter.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,22 +3,22 @@
 block discarded – undo
3 3
 
4 4
 class Waiter {
5 5
 
6
-	protected $orders;
6
+    protected $orders;
7 7
 	
8
-	public function prepareDelivery(array $drinks){
9
-		echo PEIP_LINE_SEPARATOR.'Waiter: prepareDelivery: #'.$drinks[0]->getOrderNumber();
10
-		return new Delivery($drinks);
11
-	}
8
+    public function prepareDelivery(array $drinks){
9
+        echo PEIP_LINE_SEPARATOR.'Waiter: prepareDelivery: #'.$drinks[0]->getOrderNumber();
10
+        return new Delivery($drinks);
11
+    }
12 12
 
13 13
 	
14
-	public function receiveOrder(Order $order){
15
-		echo PEIP_LINE_SEPARATOR.'Waiter: receiveOrder';
16
-		$this->orders[$order->getOrderNumber()] = $order;	
17
-	}
14
+    public function receiveOrder(Order $order){
15
+        echo PEIP_LINE_SEPARATOR.'Waiter: receiveOrder';
16
+        $this->orders[$order->getOrderNumber()] = $order;	
17
+    }
18 18
 	
19
-	public function getOrder($nr){
20
-		return $this->orders[$nr];
21
-	}
19
+    public function getOrder($nr){
20
+        return $this->orders[$nr];
21
+    }
22 22
 	
23 23
 	
24 24
 }
Please login to merge, or discard this patch.
src/Dispatcher/ClassEventDispatcher.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
                         Reflection_Pool::getInstance(
68 68
                             $object->getContent()
69 69
                         )
70
-                     ),
71
-                     $object
72
-                 );
70
+                        ),
71
+                        $object
72
+                    );
73 73
             }else{
74 74
                 throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
75 75
             }
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
         }
79 79
     }       //put your code here
80 80
 
81
-     /**
82
-     * Creates an event-object with given object as content/subject and notifies
83
-     * all registers listeners of the event.
84
-     *
85
-     * @access public
86
-     * @param string $name name of the event
87
-     * @param object $object the subject of the event
88
-     * @param array $headers headers of the event-object as key/value pairs
89
-     * @param string $eventClass event-class to create instances from
90
-     * @return
91
-     * @see EventBuilder
92
-     */
81
+        /**
82
+         * Creates an event-object with given object as content/subject and notifies
83
+         * all registers listeners of the event.
84
+         *
85
+         * @access public
86
+         * @param string $name name of the event
87
+         * @param object $object the subject of the event
88
+         * @param array $headers headers of the event-object as key/value pairs
89
+         * @param string $eventClass event-class to create instances from
90
+         * @return
91
+         * @see EventBuilder
92
+         */
93 93
     public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){
94 94
         if(!$this->hasListeners($name, ($object))){
95 95
             return false;
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  *
12 12
  * @author timo
13 13
  */
14
-use PEIP\Util\Reflection;
14
+use PEIP\Util\Reflection;
15 15
 use PEIP\Event\EventBuilder;
16 16
 
17 17
 class ClassEventDispatcher extends \PEIP\Dispatcher\ObjectEventDispatcher {
Please login to merge, or discard this patch.
examples/Cafe/example.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,19 +46,19 @@
 block discarded – undo
46 46
 
47 47
 if($cafe){
48 48
 
49
-	for ($i = 1; $i <= 10; $i++) {
50
-       	// create and place orders
51
-		$order = new Order();
52
-        	$order->addItem("LATTE", 2, false);
53
-        	$order->addItem("MOCCA", 3, true);
54
-        	$cafe->placeOrder($order);
55
-        	// receive drinks
56
-		$drinks = $cafe->receiveDelivery();
49
+    for ($i = 1; $i <= 10; $i++) {
50
+            // create and place orders
51
+        $order = new Order();
52
+            $order->addItem("LATTE", 2, false);
53
+            $order->addItem("MOCCA", 3, true);
54
+            $cafe->placeOrder($order);
55
+            // receive drinks
56
+        $drinks = $cafe->receiveDelivery();
57 57
                 var_dump($drinks);
58
-    	}	
58
+        }	
59 59
 
60 60
 }else{
61
-	throw new RuntimeException('Could not get CafeGateway');
61
+    throw new RuntimeException('Could not get CafeGateway');
62 62
 }
63 63
 
64 64
 
Please login to merge, or discard this patch.