@@ -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 | |
@@ -20,4 +20,4 @@ |
||
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | class ObjectStorage |
| 23 | - extends \SplObjectStorage{} |
|
| 23 | + extends \SplObjectStorage {} |
|
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param $subject |
| 37 | 37 | * @return |
| 38 | 38 | */ |
| 39 | - public function __construct(\ArrayAccess $methodMap, $subject){ |
|
| 39 | + public function __construct(\ArrayAccess $methodMap, $subject) { |
|
| 40 | 40 | $this->methodMap = $methodMap; |
| 41 | 41 | $this->subject = $subject; |
| 42 | 42 | } |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * @param $arguments |
| 49 | 49 | * @return |
| 50 | 50 | */ |
| 51 | - public function __call($method, array $arguments){ |
|
| 52 | - if(array_key_exists($method, $this->methodMap)){ |
|
| 51 | + public function __call($method, array $arguments) { |
|
| 52 | + if (array_key_exists($method, $this->methodMap)) { |
|
| 53 | 53 | return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -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 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * @param \PEIP\INF\Channel\PollableChannel $replyChannel The default channel to receive requests from the gateway |
| 43 | 43 | * @param array $defaultHeaders The default headers to apply to request messages |
| 44 | 44 | */ |
| 45 | - public function __construct(\PEIP\INF\Channel\Channel $requestChannel, \PEIP\INF\Channel\Channel $replyChannel = NULL, array $defaultHeaders = array()){ |
|
| 45 | + public function __construct(\PEIP\INF\Channel\Channel $requestChannel, \PEIP\INF\Channel\Channel $replyChannel = NULL, array $defaultHeaders = array()) { |
|
| 46 | 46 | $this->setRequestChannel($requestChannel); |
| 47 | - if($replyChannel){ |
|
| 47 | + if ($replyChannel) { |
|
| 48 | 48 | $this->setReplyChannel($replyChannel); |
| 49 | 49 | } |
| 50 | 50 | $this->defaultHeaders = $defaultHeaders; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @param \PEIP\INF\Channel\Channel $replyChannel The default channel to receive requests from the gateway |
| 59 | 59 | * @return |
| 60 | 60 | */ |
| 61 | - public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel){ |
|
| 61 | + public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel) { |
|
| 62 | 62 | $this->requestChannel = $requestChannel; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | * @param \PEIP\INF\Channel\PollableChannel $replyChannel The default channel to receive requests from the gateway |
| 70 | 70 | * @return |
| 71 | 71 | */ |
| 72 | - public function setReplyChannel(\PEIP\INF\Channel\Channel $replyChannel){ |
|
| 73 | - if(!($replyChannel instanceof \PEIP\INF\Channel\PollableChannel)){ |
|
| 72 | + public function setReplyChannel(\PEIP\INF\Channel\Channel $replyChannel) { |
|
| 73 | + if (!($replyChannel instanceof \PEIP\INF\Channel\PollableChannel)) { |
|
| 74 | 74 | throw new \InvalidArgumentException('reply channel must be instance of \PEIP\INF\Channel\PollableChannel.'); |
| 75 | 75 | } |
| 76 | 76 | $this->replyChannel = $replyChannel; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param mixed $content the content/payload for the message to send |
| 84 | 84 | * @return |
| 85 | 85 | */ |
| 86 | - public function send($content){ |
|
| 86 | + public function send($content) { |
|
| 87 | 87 | return $this->requestChannel->send($this->buildMessage($content)); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | * @access public |
| 94 | 94 | * @return mixed content/payload of the received message |
| 95 | 95 | */ |
| 96 | - public function receive(){ |
|
| 97 | - if(!isset($this->replyChannel)){ |
|
| 96 | + public function receive() { |
|
| 97 | + if (!isset($this->replyChannel)) { |
|
| 98 | 98 | throw new \LogicException('No replyChannel set.'); |
| 99 | 99 | } |
| 100 | 100 | $message = $this->replyChannel->receive(); |
| 101 | - if($message){ |
|
| 101 | + if ($message) { |
|
| 102 | 102 | return $message->getContent(); |
| 103 | 103 | } |
| 104 | 104 | return NULL; |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | * @param mixed $content the content/payload for the message to send |
| 112 | 112 | * @return mixed content/payload of the received message |
| 113 | 113 | */ |
| 114 | - public function sendAndReceive($content){ |
|
| 114 | + public function sendAndReceive($content) { |
|
| 115 | 115 | $this->send($content); |
| 116 | 116 | try { |
| 117 | 117 | $res = $this->receive(); |
| 118 | 118 | } |
| 119 | - catch(\Exception $e){ |
|
| 119 | + catch (\Exception $e) { |
|
| 120 | 120 | return NULL; |
| 121 | 121 | } |
| 122 | 122 | return $res; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @param mixed $content the content/payload for the message to send |
| 130 | 130 | * @return \PEIP\INF\Message\Message the built message |
| 131 | 131 | */ |
| 132 | - protected function buildMessage($content){ |
|
| 132 | + protected function buildMessage($content) { |
|
| 133 | 133 | return $this->getMessageBuilder()->setContent($content)->build(); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @access protected |
| 140 | 140 | * @return MessageBuilder message builder instance for the registerd message class |
| 141 | 141 | */ |
| 142 | - protected function getMessageBuilder(){ |
|
| 142 | + protected function getMessageBuilder() { |
|
| 143 | 143 | return isset($this->messageBuilder) && ($this->messageBuilder->getMessageClass() == $this->getMessageClass()) |
| 144 | 144 | ? $this->messageBuilder |
| 145 | 145 | : $this->messageBuilder = MessageBuilder::getInstance($this->messageClass)->setHeaders($this->defaultHeaders); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @param string $messageClass message class to create instances from |
| 153 | 153 | * @return |
| 154 | 154 | */ |
| 155 | - public function setMessageClass($messageClass){ |
|
| 155 | + public function setMessageClass($messageClass) { |
|
| 156 | 156 | $this->messageClass = $messageClass; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @access public |
| 163 | 163 | * @return string message class to create instances from |
| 164 | 164 | */ |
| 165 | - public function getMessageClass(){ |
|
| 165 | + public function getMessageClass() { |
|
| 166 | 166 | return $this->messageClass; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param $className |
| 34 | 34 | * @return |
| 35 | 35 | */ |
| 36 | - public function __construct($className){ |
|
| 36 | + public function __construct($className) { |
|
| 37 | 37 | $this->className = $className; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param $message |
| 44 | 44 | * @return |
| 45 | 45 | */ |
| 46 | - public function acceptMessage(\PEIP\INF\Message\Message $message){ |
|
| 46 | + public function acceptMessage(\PEIP\INF\Message\Message $message) { |
|
| 47 | 47 | return $message->getContent() instanceof $className; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param $type |
| 48 | 48 | * @return |
| 49 | 49 | */ |
| 50 | - public function __construct($type){ |
|
| 50 | + public function __construct($type) { |
|
| 51 | 51 | $this->type = $type; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param $message |
| 58 | 58 | * @return |
| 59 | 59 | */ |
| 60 | - public function acceptMessage(\PEIP\INF\Message\Message $message){ |
|
| 60 | + public function acceptMessage(\PEIP\INF\Message\Message $message) { |
|
| 61 | 61 | return call_user_func(self::$types[$this->type], $message->getContent()); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * @param $params |
| 35 | 35 | * @return |
| 36 | 36 | */ |
| 37 | - public function __construct($callable, array $params = array()){ |
|
| 37 | + public function __construct($callable, array $params = array()) { |
|
| 38 | 38 | $this->callable = $callable; |
| 39 | 39 | $this->setParameters($params); |
| 40 | 40 | } |