@@ -46,19 +46,19 @@ |
||
| 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 | |
@@ -4,14 +4,14 @@ |
||
| 4 | 4 | use PEIP\INF\Message\Message; |
| 5 | 5 | |
| 6 | 6 | class DrinkRouter |
| 7 | - extends Router {
|
|
| 7 | + extends Router {
|
|
| 8 | 8 | |
| 9 | - protected function selectChannels(Message $message){
|
|
| 10 | - $order = $message->getContent(); |
|
| 11 | - $channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks'; |
|
| 12 | - echo PEIP_LINE_SEPARATOR."DrinkRouter: routed to channel: $channelName"; |
|
| 13 | - return $channelName; |
|
| 14 | - } |
|
| 9 | + protected function selectChannels(Message $message){
|
|
| 10 | + $order = $message->getContent(); |
|
| 11 | + $channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks'; |
|
| 12 | + echo PEIP_LINE_SEPARATOR."DrinkRouter: routed to channel: $channelName"; |
|
| 13 | + return $channelName; |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | } |
@@ -16,13 +16,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -23,26 +23,26 @@ |
||
| 23 | 23 | |
| 24 | 24 | interface ParameterHolderCollection { |
| 25 | 25 | |
| 26 | - public function setParameters($namespace, array $parameters); |
|
| 26 | + public function setParameters($namespace, array $parameters); |
|
| 27 | 27 | |
| 28 | - public function addParameters($namespace, array $parameters); |
|
| 28 | + public function addParameters($namespace, array $parameters); |
|
| 29 | 29 | |
| 30 | - public function getParameters($namespace); |
|
| 30 | + public function getParameters($namespace); |
|
| 31 | 31 | |
| 32 | - public function getParameter($namespace, $name); |
|
| 32 | + public function getParameter($namespace, $name); |
|
| 33 | 33 | |
| 34 | - public function setParameter($namespace, $name, $value); |
|
| 34 | + public function setParameter($namespace, $name, $value); |
|
| 35 | 35 | |
| 36 | - public function hasParameter($namespace, $name); |
|
| 36 | + public function hasParameter($namespace, $name); |
|
| 37 | 37 | |
| 38 | - public function deleteParameter($namespace, $name); |
|
| 38 | + public function deleteParameter($namespace, $name); |
|
| 39 | 39 | |
| 40 | - public function setParameterHolder($namespace, \PEIP\INF\Data\ParameterHolder $holder); |
|
| 40 | + public function setParameterHolder($namespace, \PEIP\INF\Data\ParameterHolder $holder); |
|
| 41 | 41 | |
| 42 | - public function getParameterHolder($namespace); |
|
| 42 | + public function getParameterHolder($namespace); |
|
| 43 | 43 | |
| 44 | - public function hasParameterHolder($namespace); |
|
| 44 | + public function hasParameterHolder($namespace); |
|
| 45 | 45 | |
| 46 | - public function deleteParameterHolder($namespace); |
|
| 46 | + public function deleteParameterHolder($namespace); |
|
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -43,18 +43,18 @@ |
||
| 43 | 43 | } |
| 44 | 44 | } //put your code here |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Creates an event-object with given object as content/subject and notifies |
|
| 48 | - * all registers listeners of the event. |
|
| 49 | - * |
|
| 50 | - * @access public |
|
| 51 | - * @param string $name name of the event |
|
| 52 | - * @param object $object the subject of the event |
|
| 53 | - * @param array $headers headers of the event-object as key/value pairs |
|
| 54 | - * @param string $eventClass event-class to create instances from |
|
| 55 | - * @return |
|
| 46 | + /** |
|
| 47 | + * Creates an event-object with given object as content/subject and notifies |
|
| 48 | + * all registers listeners of the event. |
|
| 49 | + * |
|
| 50 | + * @access public |
|
| 51 | + * @param string $name name of the event |
|
| 52 | + * @param object $object the subject of the event |
|
| 53 | + * @param array $headers headers of the event-object as key/value pairs |
|
| 54 | + * @param string $eventClass event-class to create instances from |
|
| 55 | + * @return |
|
| 56 | 56 | boolean|null @see EventBuilder |
| 57 | - */ |
|
| 57 | + */ |
|
| 58 | 58 | public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) { |
| 59 | 59 | if (!$this->hasListeners($name, ($object))) { |
| 60 | 60 | return false; |