@@ -30,16 +30,16 @@ |
||
| 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 | } |
@@ -7,16 +7,16 @@ discard block |
||
| 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 |
||
| 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; |
@@ -6,7 +6,7 @@ |
||
| 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 | } |
@@ -8,21 +8,21 @@ |
||
| 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 | |
@@ -5,18 +5,18 @@ |
||
| 5 | 5 | |
| 6 | 6 | protected $orders; |
| 7 | 7 | |
| 8 | - public function prepareDelivery(array $drinks){ |
|
| 8 | + public function prepareDelivery(array $drinks) { |
|
| 9 | 9 | echo PEIP_LINE_SEPARATOR.'Waiter: prepareDelivery: #'.$drinks[0]->getOrderNumber(); |
| 10 | 10 | return new Delivery($drinks); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | |
| 14 | - public function receiveOrder(Order $order){ |
|
| 14 | + public function receiveOrder(Order $order) { |
|
| 15 | 15 | echo PEIP_LINE_SEPARATOR.'Waiter: receiveOrder'; |
| 16 | 16 | $this->orders[$order->getOrderNumber()] = $order; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getOrder($nr){ |
|
| 19 | + public function getOrder($nr) { |
|
| 20 | 20 | return $this->orders[$nr]; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | class ServiceContainer |
| 28 | 28 | extends \PEIP\ABS\Base\Connectable |
| 29 | 29 | implements |
| 30 | - \PEIP\INF\Service\ServiceContainer{
|
|
| 30 | + \PEIP\INF\Service\ServiceContainer {
|
|
| 31 | 31 | |
| 32 | 32 | protected $services = array(); |
| 33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param $service |
| 46 | 46 | * @return |
| 47 | 47 | */ |
| 48 | - public function setService($key, $service){
|
|
| 48 | + public function setService($key, $service) {
|
|
| 49 | 49 | $this->services[$key] = $service; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param $key |
| 56 | 56 | * @return |
| 57 | 57 | */ |
| 58 | - public function getService($key){
|
|
| 58 | + public function getService($key) {
|
|
| 59 | 59 | return $this->services[$key]; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param $key |
| 66 | 66 | * @return |
| 67 | 67 | */ |
| 68 | - public function hasService($key){
|
|
| 68 | + public function hasService($key) {
|
|
| 69 | 69 | return array_key_exists($key, $this->services); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param $key |
| 76 | 76 | * @return |
| 77 | 77 | */ |
| 78 | - public function deleteService($key){
|
|
| 78 | + public function deleteService($key) {
|
|
| 79 | 79 | unset($this->services[$key]); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | use \PEIP\Data\InternalStoreAbstract; |
| 26 | 26 | use PEIP\Factory\DedicatedFactory; |
| 27 | 27 | |
| 28 | -class ServiceContainerBuilder extends \PEIP\Data\InternalStoreAbstract{
|
|
| 28 | +class ServiceContainerBuilder extends \PEIP\Data\InternalStoreAbstract {
|
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param $factory |
| 36 | 36 | * @return |
| 37 | 37 | */ |
| 38 | - public function setFactory($key, DedicatedFactory $factory){
|
|
| 38 | + public function setFactory($key, DedicatedFactory $factory) {
|
|
| 39 | 39 | $this->setInternalValue($key, $factory); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param $key |
| 46 | 46 | * @return |
| 47 | 47 | */ |
| 48 | - public function getFactory($key){
|
|
| 48 | + public function getFactory($key) {
|
|
| 49 | 49 | $this->getInternalValue($key); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param $key |
| 56 | 56 | * @return |
| 57 | 57 | */ |
| 58 | - public function hasFactory($key){
|
|
| 58 | + public function hasFactory($key) {
|
|
| 59 | 59 | $this->hasInternalValue($key); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param $key |
| 66 | 66 | * @return |
| 67 | 67 | */ |
| 68 | - public function deleteFactory($key){
|
|
| 68 | + public function deleteFactory($key) {
|
|
| 69 | 69 | $this->deleteInternalValue($key); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param $key |
| 76 | 76 | * @return |
| 77 | 77 | */ |
| 78 | - public function getService($key){
|
|
| 78 | + public function getService($key) {
|
|
| 79 | 79 | return isset($this->services[$key]) ? $this->services[$key] : $this->services[$key] = $this->getFactory($key)->build(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param $key |
| 87 | 87 | * @return |
| 88 | 88 | */ |
| 89 | - public function buildService($key){
|
|
| 89 | + public function buildService($key) {
|
|
| 90 | 90 | return $this->getFactory($key)->build(); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @author timo |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class HeaderServiceActivator extends \PEIP\Service\ServiceActivator{
|
|
| 15 | +class HeaderServiceActivator extends \PEIP\Service\ServiceActivator {
|
|
| 16 | 16 | |
| 17 | 17 | protected $headerName; |
| 18 | 18 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param $outputChannel |
| 25 | 25 | * @return |
| 26 | 26 | */ |
| 27 | - public function __construct($serviceCallable, $headerName, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL){
|
|
| 27 | + public function __construct($serviceCallable, $headerName, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL) {
|
|
| 28 | 28 | $this->headerName = $headerName; |
| 29 | 29 | parent::__construct($serviceCallable, $inputChannel, $outputChannel); |
| 30 | 30 | } |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload |
| 39 | 39 | * @return mixed result of calling the registered service callable with message content/payload |
| 40 | 40 | */ |
| 41 | - protected function callService(\PEIP\INF\Message\Message $message){
|
|
| 41 | + protected function callService(\PEIP\INF\Message\Message $message) {
|
|
| 42 | 42 | $res = NULL; |
| 43 | - if(is_callable($this->serviceCallable)){
|
|
| 43 | + if (is_callable($this->serviceCallable)) {
|
|
| 44 | 44 | $res = call_user_func($this->serviceCallable, $message->getHeader($this->headerName)); |
| 45 | - }else{
|
|
| 46 | - if(is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')){
|
|
| 45 | + }else {
|
|
| 46 | + if (is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')) {
|
|
| 47 | 47 | $res = $this->serviceCallable->handle($message->getHeader($this->headerName)); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -33,12 +33,12 @@ |
||
| 33 | 33 | * @param $outputChannel |
| 34 | 34 | * @return |
| 35 | 35 | */ |
| 36 | - public function __construct($serviceCallable, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL){
|
|
| 36 | + public function __construct($serviceCallable, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL) {
|
|
| 37 | 37 | $this->serviceCallable = $serviceCallable; |
| 38 | - if(is_object($inputChannel)){
|
|
| 38 | + if (is_object($inputChannel)) {
|
|
| 39 | 39 | $this->setInputChannel($inputChannel); |
| 40 | 40 | } |
| 41 | - if(is_object($outputChannel)){
|
|
| 41 | + if (is_object($outputChannel)) {
|
|
| 42 | 42 | $this->setOutputChannel($outputChannel); |
| 43 | 43 | } |
| 44 | 44 | } |