@@ -58,9 +58,9 @@ |
||
58 | 58 | * @param mixed $subject subject to notify the listeners of |
59 | 59 | * @return \PEIP\INF\Handler\Handler listener that returned a boolean true value |
60 | 60 | */ |
61 | - protected static function doNotifyUntil(array $listeners, $subject){ |
|
62 | - foreach ($listeners as $listener){ |
|
63 | - if (self::doNotifyOne($listener, $subject)){ |
|
61 | + protected static function doNotifyUntil(array $listeners, $subject) { |
|
62 | + foreach ($listeners as $listener) { |
|
63 | + if (self::doNotifyOne($listener, $subject)) { |
|
64 | 64 | return $listener; |
65 | 65 | } |
66 | 66 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | protected static function doNotifyOne($listener, $subject) { |
43 | 43 | if (is_callable($listener)) { |
44 | 44 | $res = call_user_func($listener, $subject); |
45 | - }else { |
|
45 | + } else { |
|
46 | 46 | $res = $listener->handle($subject); |
47 | 47 | } |
48 | 48 | return $res; |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * @param Callable|PEIP\INF\Handler\Handler $listener listener to connect |
45 | 45 | * @return |
46 | 46 | */ |
47 | - public function connect($name, $listener){ |
|
47 | + public function connect($name, $listener) { |
|
48 | 48 | Test::ensureHandler($listener); |
49 | - if (!$this->hasListeners($name)){ |
|
49 | + if (!$this->hasListeners($name)) { |
|
50 | 50 | $this->listeners[$name] = array(); |
51 | 51 | } |
52 | 52 | $this->listeners[$name][] = $listener; |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * @param Callable|PEIP\INF\Handler\Handler $listener listener to connect |
62 | 62 | * @return |
63 | 63 | */ |
64 | - public function disconnect($name, $listener){ |
|
65 | - if (!$this->hasListeners($name)){ |
|
64 | + public function disconnect($name, $listener) { |
|
65 | + if (!$this->hasListeners($name)) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | $res = false; |
69 | - foreach ($this->listeners[$name] as $i => $callable){ |
|
70 | - if ($listener === $callable){ |
|
69 | + foreach ($this->listeners[$name] as $i => $callable) { |
|
70 | + if ($listener === $callable) { |
|
71 | 71 | unset($this->listeners[$name][$i]); |
72 | 72 | $res = true; |
73 | 73 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $res = NULL; |
61 | 61 | if (is_callable($this->serviceCallable)) { |
62 | 62 | $res = call_user_func($this->serviceCallable, $message->getContent()); |
63 | - }else { |
|
63 | + } else { |
|
64 | 64 | if (is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')) { |
65 | 65 | $res = $this->serviceCallable->handle($message->getContent()); |
66 | 66 | } |
@@ -48,11 +48,11 @@ |
||
48 | 48 | $message = NULL; |
49 | 49 | if ($timeout == 0) { |
50 | 50 | $message = $this->getMessage(); |
51 | - }elseif ($timeout < 0) { |
|
51 | + } elseif ($timeout < 0) { |
|
52 | 52 | while (!$message = $this->getMessage()) { |
53 | 53 | |
54 | 54 | } |
55 | - }else { |
|
55 | + } else { |
|
56 | 56 | $time = time() + $timeout; |
57 | 57 | while (($time > time()) && !$message = $this->getMessage()) { |
58 | 58 |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * @param string $defaultClass class to create instance for if none is set in config |
60 | 60 | * @return object build and modified srvice instance |
61 | 61 | */ |
62 | - public function buildAndModify($config, $arguments, $defaultClass = false){ |
|
62 | + public function buildAndModify($config, $arguments, $defaultClass = false) { |
|
63 | 63 | return ServiceFactory::buildAndModify($config, $arguments, $defaultClass); |
64 | 64 | } |
65 | 65 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param object $message the message to handle |
43 | 43 | * @return |
44 | 44 | */ |
45 | - public function handle($message){ |
|
45 | + public function handle($message) { |
|
46 | 46 | $this->doHandle($this->getMessageFromObject($message)); |
47 | 47 | } |
48 | 48 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * @param \PEIP\INF\Channel\Channel $inputChannel the input-channel to connect the handler to |
74 | 74 | * @return |
75 | 75 | */ |
76 | - protected function doSetInputChannel(\PEIP\INF\Channel\Channel $inputChannel){ |
|
76 | + protected function doSetInputChannel(\PEIP\INF\Channel\Channel $inputChannel) { |
|
77 | 77 | $this->inputChannel = $inputChannel; |
78 | - if($this->inputChannel instanceof \PEIP\INF\Channel\SubscribableChannel){ |
|
78 | + if ($this->inputChannel instanceof \PEIP\INF\Channel\SubscribableChannel) { |
|
79 | 79 | $this->inputChannel->subscribe($this); |
80 | - } else{ |
|
80 | + }else { |
|
81 | 81 | $this->unwrapEvents = true; |
82 | 82 | $this->inputChannel->connect('postSend', $this); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - protected function getMessageFromObject($object){ |
|
86 | + protected function getMessageFromObject($object) { |
|
87 | 87 | $content = $object->getContent(); |
88 | - if($this->unwrapEvents |
|
88 | + if ($this->unwrapEvents |
|
89 | 89 | && $object instanceof \PEIP\INF\Event\Event |
90 | 90 | && $object->getName() == 'postSend' |
91 | 91 | && $object->hasHeader(Pipe::HEADER_MESSAGE) |
92 | 92 | && $content instanceof \PEIP\INF\Channel\PollableChannel |
93 | - ){ |
|
93 | + ) { |
|
94 | 94 | $object = $content->receive(); |
95 | 95 | } |
96 | 96 | if (!($object instanceof \PEIP\INF\Message\Message)) { |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $store = $this->factory->build(); |
51 | 51 | if ($store instanceof \PEIP\INF\Data\ParameterHolder) { |
52 | 52 | $this->stores[$namespace] = $store; |
53 | - }else { |
|
53 | + } else { |
|
54 | 54 | throw new \Exception('Could not build Instance of \PEIP\INF\Data\ParameterHolder from factory.'); |
55 | 55 | } |
56 | 56 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $store = $this->factory->build(); |
55 | 55 | if ($store instanceof \PEIP\INF\Data\Store) { |
56 | 56 | $this->setPrivateValue($namespace, $store); |
57 | - }else { |
|
57 | + } else { |
|
58 | 58 | throw new \Exception('Could not build Instance of \PEIP\INF\Data\Store from factory.'); |
59 | 59 | } |
60 | 60 | } |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | throw new \Exception('loading XML failed'); |
31 | 31 | } |
32 | 32 | |
33 | - } |
|
34 | - catch (\Exception $e) { |
|
33 | + } catch (\Exception $e) { |
|
35 | 34 | return false; |
36 | 35 | } |
37 | 36 | |
@@ -65,7 +64,7 @@ discard block |
||
65 | 64 | ) |
66 | 65 | ); |
67 | 66 | } |
68 | - }else { |
|
67 | + } else { |
|
69 | 68 | $array[$name] = array(); |
70 | 69 | } |
71 | 70 | $array[$name][] = $res; |