@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | class VisitableArray |
26 | 26 | extends \RecursiveArrayIterator |
27 | - implements \PEIP\INF\Base\Visitable{ |
|
27 | + implements \PEIP\INF\Base\Visitable { |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * @param $visitor |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public function acceptVisitor(\PEIP\INF\Base\Visitor $visitor){ |
|
37 | - if($this->hasChildren()){ |
|
38 | - foreach($this->getChildren as $child){ |
|
36 | + public function acceptVisitor(\PEIP\INF\Base\Visitor $visitor) { |
|
37 | + if ($this->hasChildren()) { |
|
38 | + foreach ($this->getChildren as $child) { |
|
39 | 39 | $child->acceptVisitor($visitor); |
40 | 40 | } |
41 | 41 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param string $className name of the class to return ReflectionClass for |
33 | 33 | * @return ReflectionClass the ReflectionClass instance for given class |
34 | 34 | */ |
35 | - protected static function getReflectionClass($className){ |
|
35 | + protected static function getReflectionClass($className) { |
|
36 | 36 | return array_key_exists($className, self::$reflectionClasses) |
37 | 37 | ? self::$reflectionClasses[$className] |
38 | 38 | : (self::$reflectionClasses[$className] = new \ReflectionClass($className)); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param string $className name of the class to return ReflectionClass for |
48 | 48 | * @return ReflectionClass the ReflectionClass instance for given class |
49 | 49 | */ |
50 | - public static function getInstance($className){ |
|
50 | + public static function getInstance($className) { |
|
51 | 51 | return self::getReflectionClass($className); |
52 | 52 | } |
53 | 53 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param $methodMap |
31 | 31 | * @return |
32 | 32 | */ |
33 | - public function __construct(ArrayAccess $methodMap){ |
|
33 | + public function __construct(ArrayAccess $methodMap) { |
|
34 | 34 | $this->methodMap = $methodMap; |
35 | 35 | } |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param $subject |
41 | 41 | * @return |
42 | 42 | */ |
43 | - public function setSubject($subject){ |
|
43 | + public function setSubject($subject) { |
|
44 | 44 | $this->subject = $subject; |
45 | 45 | return $this; |
46 | 46 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param $arguments |
53 | 53 | * @return |
54 | 54 | */ |
55 | - public function __call($method, $arguments){ |
|
56 | - if(array_key_exists($method, $this->methodMap)){ |
|
55 | + public function __call($method, $arguments) { |
|
56 | + if (array_key_exists($method, $this->methodMap)) { |
|
57 | 57 | return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments); |
58 | 58 | } |
59 | 59 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param ObjectStorage $store an instane of ObjectStorage to act as the internal object-store |
39 | 39 | * @return |
40 | 40 | */ |
41 | - public function __construct(\SplObjectStorage $store = NULL){ |
|
41 | + public function __construct(\SplObjectStorage $store = NULL) { |
|
42 | 42 | $this->store = (bool)$store ? $store : new ObjectStorage; |
43 | 43 | } |
44 | 44 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param object $box an object to act as the 'box' |
54 | 54 | * @return object the 'box' for the sealed value |
55 | 55 | */ |
56 | - public function seal($value, $box = false){ |
|
56 | + public function seal($value, $box = false) { |
|
57 | 57 | $box = (bool)$box ? $box : new \stdClass; |
58 | 58 | $this->store[$box] = $value; |
59 | 59 | return $box; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param object $box the box-object to return the value for. |
67 | 67 | * @return |
68 | 68 | */ |
69 | - public function unseal($box){ |
|
69 | + public function unseal($box) { |
|
70 | 70 | return $this->store[$box]; |
71 | 71 | } |
72 | 72 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | protected |
30 | 30 | $eventName; |
31 | 31 | |
32 | - public function connectChannel(\PEIP\INF\Channel\Channel $inputChannel){ |
|
32 | + public function connectChannel(\PEIP\INF\Channel\Channel $inputChannel) { |
|
33 | 33 | $this->inputChannel = $inputChannel; |
34 | 34 | |
35 | 35 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param \PEIP\INF\Channel\Channel $inputChannel the input-channel to listen for events. |
45 | 45 | * @return |
46 | 46 | */ |
47 | - public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel){ |
|
47 | + public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel) { |
|
48 | 48 | $this->connectChannel($inputChannel); |
49 | 49 | } |
50 | 50 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @access protected |
61 | 61 | * @param \PEIP\INF\Message\Message $message the message to reply with |
62 | 62 | */ |
63 | - protected function doReply(\PEIP\INF\Message\Message $message){ |
|
63 | + protected function doReply(\PEIP\INF\Message\Message $message) { |
|
64 | 64 | $headerMessage = $message->getHeader('MESSAGE'); |
65 | - if($headerMessage instanceof \PEIP\INF\Message\Message){ |
|
65 | + if ($headerMessage instanceof \PEIP\INF\Message\Message) { |
|
66 | 66 | return $this->replyMessage($headerMessage); |
67 | 67 | } |
68 | 68 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param \PEIP\INF\Event\Connectable $connectable the connectable to listen to |
76 | 76 | * @return |
77 | 77 | */ |
78 | - public function listen(\PEIP\INF\Event\Connectable $connectable){ |
|
78 | + public function listen(\PEIP\INF\Event\Connectable $connectable) { |
|
79 | 79 | return $this->doListen($this->eventName, $connectable); |
80 | 80 | } |
81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param \PEIP\INF\Event\Connectable $connectable the connectable to unlisten |
88 | 88 | * @return |
89 | 89 | */ |
90 | - public function unlisten(\PEIP\INF\Event\Connectable $connectable){ |
|
90 | + public function unlisten(\PEIP\INF\Event\Connectable $connectable) { |
|
91 | 91 | return $this->doUnlisten($this->eventName, $connectable); |
92 | 92 | } |
93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @access public |
98 | 98 | * @return array array of \PEIP\INF\Event\Connectable instances |
99 | 99 | */ |
100 | - public function getConnected(){ |
|
100 | + public function getConnected() { |
|
101 | 101 | return $this->doGetConnected(); |
102 | 102 | } |
103 | 103 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param \PEIP\INF\Channel\Channel $channel \PEIP\INF\Channel\Channel instance to disconnect from |
109 | 109 | * @return |
110 | 110 | */ |
111 | - public function disconnectChannel(\PEIP\INF\Channel\Channel $channel){ |
|
111 | + public function disconnectChannel(\PEIP\INF\Channel\Channel $channel) { |
|
112 | 112 | $this->disconnectInputChannel(); |
113 | 113 | $this->inputChannel = $channel; |
114 | 114 | $this->connectInputChannel(); |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @access protected |
122 | 122 | * @return |
123 | 123 | */ |
124 | - protected function connectInputChannel(){ |
|
125 | - if($this->inputChannel && $this->eventName){ |
|
124 | + protected function connectInputChannel() { |
|
125 | + if ($this->inputChannel && $this->eventName) { |
|
126 | 126 | $this->inputChannel->connect($this->eventName, $this); |
127 | 127 | } |
128 | 128 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @access protected |
135 | 135 | * @return |
136 | 136 | */ |
137 | - protected function disconnectInputChannel(){ |
|
138 | - if($this->inputChannel && $this->eventName){ |
|
137 | + protected function disconnectInputChannel() { |
|
138 | + if ($this->inputChannel && $this->eventName) { |
|
139 | 139 | $this->inputChannel->disconnect($this->eventName, $this); |
140 | 140 | } |
141 | 141 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param $eventName |
148 | 148 | * @return |
149 | 149 | */ |
150 | - public function setEventName($eventName){ |
|
150 | + public function setEventName($eventName) { |
|
151 | 151 | $this->disconnectInputChannel(); |
152 | 152 | $this->eventName = $eventName; |
153 | 153 | $this->connectInputChannel(); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param $outputChannel |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public function __construct($eventName, \PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel){ |
|
36 | + public function __construct($eventName, \PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel) { |
|
37 | 37 | $this->setEventName($eventName); |
38 | 38 | $this->setInputChannel($inputChannel); |
39 | 39 | $this->setOutputChannel($outputChannel); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @param $content |
35 | 35 | * @return |
36 | 36 | */ |
37 | - protected function replyMessage($content){ |
|
37 | + protected function replyMessage($content) { |
|
38 | 38 | $message = $this->ensureMessage($content); |
39 | 39 | $this->getOutputChannel()->command($message); |
40 | 40 | } |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * @param \PEIP\INF\Channel\PollableChannel $replyChannel The default channel to receive requests from the gateway |
44 | 44 | * @param array $defaultHeaders The default headers to apply to request messages |
45 | 45 | */ |
46 | - public function __construct(\PEIP\INF\Channel\Channel $requestChannel, \PEIP\INF\Channel\Channel $replyChannel = NULL, array $defaultHeaders = array()){ |
|
46 | + public function __construct(\PEIP\INF\Channel\Channel $requestChannel, \PEIP\INF\Channel\Channel $replyChannel = NULL, array $defaultHeaders = array()) { |
|
47 | 47 | $this->setRequestChannel($requestChannel); |
48 | - if($replyChannel){ |
|
48 | + if ($replyChannel) { |
|
49 | 49 | $this->setReplyChannel($replyChannel); |
50 | 50 | } |
51 | 51 | $this->defaultHeaders = $defaultHeaders; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param \PEIP\INF\Channel\Channel $replyChannel The default channel to receive requests from the gateway |
60 | 60 | * @return |
61 | 61 | */ |
62 | - public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel){ |
|
62 | + public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel) { |
|
63 | 63 | $this->requestChannel = $requestChannel; |
64 | 64 | } |
65 | 65 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @param \PEIP\INF\Channel\PollableChannel $replyChannel The default channel to receive requests from the gateway |
71 | 71 | * @return |
72 | 72 | */ |
73 | - public function setReplyChannel(\PEIP\INF\Channel\Channel $replyChannel){ |
|
74 | - if(!($replyChannel instanceof \PEIP\INF\Channel\PollableChannel)){ |
|
73 | + public function setReplyChannel(\PEIP\INF\Channel\Channel $replyChannel) { |
|
74 | + if (!($replyChannel instanceof \PEIP\INF\Channel\PollableChannel)) { |
|
75 | 75 | throw new \InvalidArgumentException('reply channel must be instance of \PEIP\INF\Channel\PollableChannel.'); |
76 | 76 | } |
77 | 77 | $this->replyChannel = $replyChannel; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param mixed $content the content/payload for the message to send |
85 | 85 | * @return |
86 | 86 | */ |
87 | - public function send($content){ |
|
87 | + public function send($content) { |
|
88 | 88 | return $this->requestChannel->send($this->buildMessage($content)); |
89 | 89 | } |
90 | 90 | |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | * @access public |
95 | 95 | * @return mixed content/payload of the received message |
96 | 96 | */ |
97 | - public function receive(){ |
|
98 | - if(!isset($this->replyChannel)){ |
|
97 | + public function receive() { |
|
98 | + if (!isset($this->replyChannel)) { |
|
99 | 99 | throw new \LogicException('No replyChannel set.'); |
100 | 100 | } |
101 | 101 | $message = $this->replyChannel->receive(); |
102 | - if($message){ |
|
102 | + if ($message) { |
|
103 | 103 | return $message->getContent(); |
104 | 104 | } |
105 | 105 | return NULL; |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | * @param mixed $content the content/payload for the message to send |
113 | 113 | * @return mixed content/payload of the received message |
114 | 114 | */ |
115 | - public function sendAndReceive($content){ |
|
115 | + public function sendAndReceive($content) { |
|
116 | 116 | $this->send($content); |
117 | 117 | try { |
118 | 118 | $res = $this->receive(); |
119 | 119 | } |
120 | - catch(\Exception $e){ |
|
120 | + catch (\Exception $e) { |
|
121 | 121 | return NULL; |
122 | 122 | } |
123 | 123 | return $res; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param mixed $content the content/payload for the message to send |
131 | 131 | * @return \PEIP\INF\Message\Message the built message |
132 | 132 | */ |
133 | - protected function buildMessage($content){ |
|
133 | + protected function buildMessage($content) { |
|
134 | 134 | return $this->getMessageBuilder()->setContent($content)->build(); |
135 | 135 | } |
136 | 136 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @access protected |
141 | 141 | * @return MessageBuilder message builder instance for the registerd message class |
142 | 142 | */ |
143 | - protected function getMessageBuilder(){ |
|
143 | + protected function getMessageBuilder() { |
|
144 | 144 | return isset($this->messageBuilder) && ($this->messageBuilder->getMessageClass() == $this->getMessageClass()) |
145 | 145 | ? $this->messageBuilder |
146 | 146 | : $this->messageBuilder = MessageBuilder::getInstance($this->messageClass)->setHeaders($this->defaultHeaders); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param string $messageClass message class to create instances from |
154 | 154 | * @return |
155 | 155 | */ |
156 | - public function setMessageClass($messageClass){ |
|
156 | + public function setMessageClass($messageClass) { |
|
157 | 157 | $this->messageClass = $messageClass; |
158 | 158 | } |
159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @access public |
164 | 164 | * @return string message class to create instances from |
165 | 165 | */ |
166 | - public function getMessageClass(){ |
|
166 | + public function getMessageClass() { |
|
167 | 167 | return $this->messageClass; |
168 | 168 | } |
169 | 169 |
@@ -116,8 +116,7 @@ |
||
116 | 116 | $this->send($content); |
117 | 117 | try { |
118 | 118 | $res = $this->receive(); |
119 | - } |
|
120 | - catch(\Exception $e){ |
|
119 | + } catch(\Exception $e){ |
|
121 | 120 | return NULL; |
122 | 121 | } |
123 | 122 | return $res; |
@@ -56,7 +56,6 @@ discard block |
||
56 | 56 | * sets the channel to send requests from the gateway |
57 | 57 | * |
58 | 58 | * @access public |
59 | - * @param \PEIP\INF\Channel\Channel $replyChannel The default channel to receive requests from the gateway |
|
60 | 59 | * @return |
61 | 60 | */ |
62 | 61 | public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel){ |
@@ -109,7 +108,7 @@ discard block |
||
109 | 108 | * sends and receives a request/message through the gateway |
110 | 109 | * |
111 | 110 | * @access public |
112 | - * @param mixed $content the content/payload for the message to send |
|
111 | + * @param \Order $content the content/payload for the message to send |
|
113 | 112 | * @return mixed content/payload of the received message |
114 | 113 | */ |
115 | 114 | public function sendAndReceive($content){ |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @return array array with interface/class info for the class |
31 | 31 | */ |
32 | 32 | |
33 | - public static function getImplementedClassesAndInterfaces($class, $store = true){ |
|
33 | + public static function getImplementedClassesAndInterfaces($class, $store = true) { |
|
34 | 34 | $class = is_object($class) ? get_class($class) : (string)$class; |
35 | - if(isset(self::$classInfo[$class])){ |
|
35 | + if (isset(self::$classInfo[$class])) { |
|
36 | 36 | return self::$classInfo[$class]; |
37 | 37 | } |
38 | 38 | $cls = ReflectionPool::getInstance($class); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $classInfo = (array)$cls->getInterfaceNames(); |
41 | 41 | $classInfo[] = $cls->getName(); |
42 | 42 | // get names of parent-classes |
43 | - while($cls = $cls->getParentClass()){ |
|
43 | + while ($cls = $cls->getParentClass()) { |
|
44 | 44 | $classInfo[] = $cls->getName(); |
45 | 45 | } |
46 | 46 |