@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | abstract class SubscribableChannel |
31 | 31 | extends \PEIP\ABS\Channel\Channel |
32 | - implements \PEIP\INF\Channel\SubscribableChannel{ |
|
32 | + implements \PEIP\INF\Channel\SubscribableChannel { |
|
33 | 33 | |
34 | 34 | protected $messageDispatcher; |
35 | 35 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param Callable|PEIP\INF\Handler\Handler $handler the listener to subscribe |
42 | 42 | * @return |
43 | 43 | */ |
44 | - public function subscribe($handler){ |
|
44 | + public function subscribe($handler) { |
|
45 | 45 | Test::ensureHandler($handler); |
46 | 46 | $this->getMessageDispatcher()->connect($handler); |
47 | 47 | $this->doFireEvent('subscribe', array('SUBSCRIBER'=>$handler)); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param Callable|PEIP\INF\Handler\Handler $handler the listener to unsubscribe |
56 | 56 | * @return |
57 | 57 | */ |
58 | - public function unsubscribe($handler){ |
|
58 | + public function unsubscribe($handler) { |
|
59 | 59 | Test::ensureHandler($handler); |
60 | 60 | $this->getMessageDispatcher()->disconnect($handler); |
61 | 61 | $this->doFireEvent('unsubscribe', array('SUBSCRIBER'=>$handler)); |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param boolean $transferListeners wether to transfer listeners of old dispatcher (if set) to new one. default: true |
70 | 70 | * @return |
71 | 71 | */ |
72 | - public function setMessageDispatcher(\PEIP\INF\Dispatcher\Dispatcher $dispatcher, $transferListeners = true){ |
|
73 | - if(isset($this->dispatcher) && $transferListeners){ |
|
74 | - foreach($this->dispatcher->getListeners() as $listener){ |
|
72 | + public function setMessageDispatcher(\PEIP\INF\Dispatcher\Dispatcher $dispatcher, $transferListeners = true) { |
|
73 | + if (isset($this->dispatcher) && $transferListeners) { |
|
74 | + foreach ($this->dispatcher->getListeners() as $listener) { |
|
75 | 75 | $dispatcher->connect($listener); |
76 | 76 | $this->dispatcher->disconnect($listener); |
77 | 77 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @access public |
86 | 86 | * @return |
87 | 87 | */ |
88 | - public function getMessageDispatcher(){ |
|
88 | + public function getMessageDispatcher() { |
|
89 | 89 | return isset($this->dispatcher) ? $this->dispatcher : $this->dispatcher = new Dispatcher; |
90 | 90 | } |
91 | 91 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @implements \PEIP\INF\Base\Container, \PEIP\INF\Message\Message, \PEIP\INF\Base\Buildable |
21 | 21 | */ |
22 | 22 | |
23 | -use PEIP\Util\Test; |
|
23 | +use PEIP\Util\Test; |
|
24 | 24 | use PEIP\Base\GenericBuilder; |
25 | 25 | |
26 | 26 | class GenericMessage |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param $name |
35 | 35 | * @return |
36 | 36 | */ |
37 | - public function __construct($name){ |
|
37 | + public function __construct($name) { |
|
38 | 38 | $this->name = $name; |
39 | 39 | } |
40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @access public |
43 | 43 | * @return string the channel�s name |
44 | 44 | */ |
45 | - public function getName(){ |
|
45 | + public function getName() { |
|
46 | 46 | return $this->name; |
47 | 47 | } |
48 | 48 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param integer $timeout |
53 | 53 | * @return |
54 | 54 | */ |
55 | - public function send(\PEIP\INF\Message\Message $message, $timeout = -1){ |
|
55 | + public function send(\PEIP\INF\Message\Message $message, $timeout = -1) { |
|
56 | 56 | $this->doFireEvent('preSend', array('MESSAGE'=>$message)); |
57 | 57 | $sent = $this->doSend($message); |
58 | 58 | $this->doFireEvent('postSend', array( |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @access public |
41 | 41 | * @return |
42 | 42 | */ |
43 | - public function __invoke(){ |
|
43 | + public function __invoke() { |
|
44 | 44 | return $this->execute(); |
45 | 45 | } |
46 | 46 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @access public |
52 | 52 | * @return |
53 | 53 | */ |
54 | - public function execute(){ |
|
54 | + public function execute() { |
|
55 | 55 | return call_user_func_array($this->callable, $this->getParameters()); |
56 | 56 | } |
57 | 57 |
@@ -47,18 +47,18 @@ |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - /** |
|
51 | - * Builds and modifies an arbitrary service/object instance from a config-obect. |
|
52 | - * |
|
53 | - * @see XMLContext::doBuild |
|
54 | - * @see XMLContext::modifyService |
|
55 | - * @implements \PEIP\INF\Context\Context |
|
56 | - * @access public |
|
57 | - * @param object $config configuration object to build a service instance from. |
|
58 | - * @param array $arguments arguments for the service constructor |
|
59 | - * @param string $defaultClass class to create instance for if none is set in config |
|
60 | - * @return object build and modified srvice instance |
|
61 | - */ |
|
50 | + /** |
|
51 | + * Builds and modifies an arbitrary service/object instance from a config-obect. |
|
52 | + * |
|
53 | + * @see XMLContext::doBuild |
|
54 | + * @see XMLContext::modifyService |
|
55 | + * @implements \PEIP\INF\Context\Context |
|
56 | + * @access public |
|
57 | + * @param object $config configuration object to build a service instance from. |
|
58 | + * @param array $arguments arguments for the service constructor |
|
59 | + * @param string $defaultClass class to create instance for if none is set in config |
|
60 | + * @return object build and modified srvice instance |
|
61 | + */ |
|
62 | 62 | public function buildAndModify($config, $arguments, $defaultClass = false){ |
63 | 63 | return ServiceFactory::buildAndModify($config, $arguments, $defaultClass); |
64 | 64 | } |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * @param \PEIP\INF\Context\Context $context context instance to register the plugin with |
41 | 41 | * @return |
42 | 42 | */ |
43 | - public function init(\PEIP\INF\Context\Context $context){ |
|
43 | + public function init(\PEIP\INF\Context\Context $context) { |
|
44 | 44 | $this->context = $context; |
45 | - foreach($this->builders as $node=>$method){ |
|
45 | + foreach ($this->builders as $node=>$method) { |
|
46 | 46 | $context->registerNodeBuilder($node, array($this, $method)); |
47 | 47 | } |
48 | 48 | } |
@@ -59,7 +59,7 @@ discard block |
||
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 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * |
12 | 12 | * @author timo |
13 | 13 | */ |
14 | -use PEIP\Context\XMLContext; |
|
14 | +use PEIP\Context\XMLContext; |
|
15 | 15 | use PEIP\Plugins\BasePlugin; |
16 | 16 | |
17 | 17 | class ServiceProvider extends \PEIP\Service\ServiceContainer { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param $connection |
38 | 38 | * @return |
39 | 39 | */ |
40 | - public function setConnection($connection){ |
|
40 | + public function setConnection($connection) { |
|
41 | 41 | $this->connection = $connection; |
42 | 42 | } |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @access public |
48 | 48 | * @return |
49 | 49 | */ |
50 | - public function execute(){ |
|
50 | + public function execute() { |
|
51 | 51 | return $this->send(); |
52 | 52 | } |
53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @access public |
57 | 57 | * @return |
58 | 58 | */ |
59 | - public function send(){ |
|
59 | + public function send() { |
|
60 | 60 | return $this->connection->sendRequest($this); |
61 | 61 | } |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @access public |
66 | 66 | * @return |
67 | 67 | */ |
68 | - public function getRequestData(){ |
|
68 | + public function getRequestData() { |
|
69 | 69 | return $this->doGetRequestData(); |
70 | 70 | } |
71 | 71 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @param $request |
35 | 35 | * @return |
36 | 36 | */ |
37 | - public function sendRequest(\PEIP\ABS\Request\Request $request){ |
|
37 | + public function sendRequest(\PEIP\ABS\Request\Request $request) { |
|
38 | 38 | return $this->doSendRequest($request); |
39 | 39 | } |
40 | 40 |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param \PEIP\INF\Channel\Channel $outputChannel the outputs-channel |
36 | 36 | * @return |
37 | 37 | */ |
38 | - public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL){ |
|
38 | + public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL) { |
|
39 | 39 | $this->setInputChannel($inputChannel); |
40 | - if(is_object($outputChannel)){ |
|
40 | + if (is_object($outputChannel)) { |
|
41 | 41 | $this->setOutputChannel($outputChannel); |
42 | 42 | } |
43 | 43 | } |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @param \PEIP\INF\Message\Message $message message to split |
50 | 50 | * @return |
51 | 51 | */ |
52 | - public function doReply(\PEIP\INF\Message\Message $message){ |
|
52 | + public function doReply(\PEIP\INF\Message\Message $message) { |
|
53 | 53 | $res = $this->split($message); |
54 | - if(is_array($res)){ |
|
55 | - foreach($res as $msg){ |
|
54 | + if (is_array($res)) { |
|
55 | + foreach ($res as $msg) { |
|
56 | 56 | $this->replyMessage($msg); |
57 | 57 | } |
58 | - }else{ |
|
58 | + }else { |
|
59 | 59 | $this->replyMessage($res); |
60 | 60 | } |
61 | 61 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | protected function getMessage($object){ |
18 | 18 | if($this->channel instanceof \PEIP\INF\Channel\SubscribableChannel){ |
19 | 19 | return $object; |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | return $object->getContent()->receive(); |
22 | 22 | } |
23 | 23 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | EVENT_PRE_RESOLVE = 'pre_resolve', |
35 | 35 | EVENT_POST_RESOLVE = 'post_resolve', |
36 | 36 | EVENT_ERR_RESOLVE = 'err_resolve', |
37 | - HEADER_CHANNEL = 'CHANNEL', |
|
37 | + HEADER_CHANNEL = 'CHANNEL', |
|
38 | 38 | HEADER_CHANNEL_NAME = 'CHANNEL_NAME', |
39 | 39 | HEADER_CHANNEL_RESOLVER = 'HEADER_CHANNEL_RESOLVER'; |
40 | 40 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \PEIP\INF\Channel\Channel $inputChannel the input channel for the router |
49 | 49 | * @return |
50 | 50 | */ |
51 | - public function __construct(\PEIP\INF\Channel\Channel_Resolver $channelResolver, \PEIP\INF\Channel\Channel $inputChannel){ |
|
51 | + public function __construct(\PEIP\INF\Channel\Channel_Resolver $channelResolver, \PEIP\INF\Channel\Channel $inputChannel) { |
|
52 | 52 | $this->channelResolver = $channelResolver; |
53 | 53 | $this->setInputChannel($inputChannel); |
54 | 54 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param \PEIP\INF\Channel\Channel_Resolver $channelResolver the channel resolver for the router |
61 | 61 | * @return |
62 | 62 | */ |
63 | - public function setChannelResolver(\PEIP\INF\Channel\Channel_Resolver $channelResolver){ |
|
63 | + public function setChannelResolver(\PEIP\INF\Channel\Channel_Resolver $channelResolver) { |
|
64 | 64 | $this->doFireEvent(self::EVENT_CHANNEL_RESOLVER_SET, array(self::HEADER_CHANNEL_RESOLVER=>$channelResolver)); |
65 | 65 | $this->channelResolver = $channelResolver; |
66 | 66 | $this->doFireEvent(self::EVENT_CHANNEL_RESOLVER_SET, array(self::HEADER_CHANNEL_RESOLVER=>$channelResolver)); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * @param \PEIP\INF\Message\Message $message the message to reply with |
74 | 74 | * @return |
75 | 75 | */ |
76 | - protected function doReply(\PEIP\INF\Message\Message $message){ |
|
76 | + protected function doReply(\PEIP\INF\Message\Message $message) { |
|
77 | 77 | $channels = (array)$this->selectChannels($message); |
78 | - foreach($channels as $channel){ |
|
78 | + foreach ($channels as $channel) { |
|
79 | 79 | $this->setOutputChannel($this->resolveChannel($channel)); |
80 | 80 | $this->replyMessage($message); |
81 | 81 | } |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | * @param mixed $channel channel-name or instance of \PEIP\INF\Channel\Channel |
91 | 91 | * @return |
92 | 92 | */ |
93 | - protected function resolveChannel($channel){ |
|
93 | + protected function resolveChannel($channel) { |
|
94 | 94 | $this->doFireEvent(self::EVENT_PRE_RESOLVE, array(self::HEADER_CHANNEL=>$channel)); |
95 | - if(!($channel instanceof \PEIP\INF\Channel\Channel)){ |
|
95 | + if (!($channel instanceof \PEIP\INF\Channel\Channel)) { |
|
96 | 96 | $channelName = $channel; |
97 | 97 | $channel = $this->channelResolver->resolveChannelName($channelName); |
98 | - if(!$channel){ |
|
98 | + if (!$channel) { |
|
99 | 99 | $this->doFireEvent(self::EVENT_ERR_RESOLVE, array(self::HEADER_CHANNEL_NAME=>$channelName)); |
100 | 100 | throw new \RuntimeException('Could not resolve Channel : '.$channelName); |
101 | 101 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * @param $headers |
36 | 36 | * @return |
37 | 37 | */ |
38 | - public function __construct($content, ArrayAccess $headers = NULL){ |
|
39 | - if(!($content instanceof \PEIP\INF\Command\Command) && !is_callable($content)){ |
|
38 | + public function __construct($content, ArrayAccess $headers = NULL) { |
|
39 | + if (!($content instanceof \PEIP\INF\Command\Command) && !is_callable($content)) { |
|
40 | 40 | throw new \BadArgumentException('Argument 1 for CommandMessage::__construct must be callable or implment \PEIP\INF\Command\Command'); |
41 | 41 | } |
42 | 42 | |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * @access public |
50 | 50 | * @return |
51 | 51 | */ |
52 | - public function execute(){ |
|
53 | - if(is_callable($this->getContent())){ |
|
52 | + public function execute() { |
|
53 | + if (is_callable($this->getContent())) { |
|
54 | 54 | return call_user_func($this->getContent()); |
55 | - }else{ |
|
55 | + }else { |
|
56 | 56 | return $this->getContent()->execute(); |
57 | 57 | } |
58 | 58 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | protected function getMessage($object){ |
18 | 18 | if($this->channel instanceof \PEIP\INF\Channel\SubscribableChannel){ |
19 | 19 | return $object; |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | return $object->getContent()->receive(); |
22 | 22 | } |
23 | 23 | } |