Completed
Push — v1.ns ( 5d136b...6b2792 )
by Timo
03:00
created
src/ABS/Dispatcher/MapDispatcher.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,6 @@
 block discarded – undo
80 80
      *
81 81
      * @access public
82 82
      * @param string $name name of the event
83
-     * @param Callable|PEIP\INF\Handler\Handler $listener listener to connect
84 83
      * @return
85 84
      */
86 85
     public function disconnectAll($name){
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function connect($name, $listener){
48 48
         Test::ensureHandler($listener);
49 49
         if (!$this->hasListeners($name)){
50
-          $this->listeners[$name] = array();
50
+            $this->listeners[$name] = array();
51 51
         }
52 52
         $this->listeners[$name][] = $listener;
53 53
         return true;
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
         }
68 68
         $res = false;
69 69
         foreach ($this->listeners[$name] as $i => $callable){
70
-          if ($listener === $callable){
70
+            if ($listener === $callable){
71 71
             unset($this->listeners[$name][$i]);
72 72
             $res = true;
73
-          }
73
+            }
74 74
         }
75 75
         return $res;
76 76
     }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
           }
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
      * @param Callable|PEIP\INF\Handler\Handler $listener listener to connect
84 84
      * @return
85 85
      */
86
-    public function disconnectAll($name){
87
-        if (!isset($this->listeners[$name])){
86
+    public function disconnectAll($name) {
87
+        if (!isset($this->listeners[$name])) {
88 88
             return false;
89 89
         }
90 90
         $this->listeners[$name] = array();
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
      * @param string $name name of the event 
99 99
      * @return boolean wether any listener is registered for event-name
100 100
      */
101
-    public function hasListeners($name){
102
-        if (!isset($this->listeners[$name])){
101
+    public function hasListeners($name) {
102
+        if (!isset($this->listeners[$name])) {
103 103
             return false;
104 104
         }
105
-        return (boolean) count($this->listeners[$name]);
105
+        return (boolean)count($this->listeners[$name]);
106 106
     }
107 107
     
108 108
     /**
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
      * @param mixed $subject the subject 
114 114
      * @return boolean success
115 115
      */
116
-    public function notify($name, $subject){
117
-        if($this->hasListeners($name)){
116
+    public function notify($name, $subject) {
117
+        if ($this->hasListeners($name)) {
118 118
             self::doNotify($this->getListeners($name), $subject);
119 119
             return true;
120 120
         }
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
      * @param mixed $subject the subject 
130 130
      * @return \PEIP\INF\Handler\Handler listener which returned a boolean true value
131 131
      */
132
-    public function notifyUntil($name, $subject){
133
-        if($this->hasListeners($name)){
132
+    public function notifyUntil($name, $subject) {
133
+        if ($this->hasListeners($name)) {
134 134
             return self::doNotifyUntil($this->getListeners($name), $subject);   
135 135
         }
136 136
         return NULL;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
      * @param $name 
144 144
      * @return array array of \PEIP\INF\Handler\Handler instances
145 145
      */
146
-    public function getListeners($name){
147
-        if (!isset($this->listeners[$name])){
146
+    public function getListeners($name) {
147
+        if (!isset($this->listeners[$name])) {
148 148
         return array();
149 149
         }
150 150
         return $this->listeners[$name];
Please login to merge, or discard this patch.
src/ABS/Handler/MessageHandler.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      * @see PEIP\ABS\Handler\MessageHandler::doSetInputChannel
55 55
      * @access public
56 56
      * @param \PEIP\INF\Channel\Channel $inputChannel the input-channel
57
-     * @return PEIP\ABS\Handler\MessageHandler $this;
57
+     * @return MessageHandler $this;
58 58
      */
59 59
     public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel){
60 60
         $this->doSetInputChannel($inputChannel);
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @return 
44 44
      */
45 45
     public function handle($message){
46
-         $this->doHandle($this->getMessageFromObject($message));      
46
+            $this->doHandle($this->getMessageFromObject($message));      
47 47
     }
48 48
    
49 49
     /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
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
    
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param \PEIP\INF\Channel\Channel $inputChannel the input-channel
57 57
      * @return PEIP\ABS\Handler\MessageHandler $this;
58 58
      */
59
-    public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel){
59
+    public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel) {
60 60
         $this->doSetInputChannel($inputChannel);
61 61
         return $this;
62 62
     }
@@ -73,24 +73,24 @@  discard block
 block discarded – undo
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)) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      * @access public
107 107
      * @return \PEIP\INF\Channel\Channel input-channel for this handler
108 108
      */
109
-    public function getInputChannel(){
109
+    public function getInputChannel() {
110 110
         return $this->inputChannel;
111 111
     }   
112 112
       
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
         $this->inputChannel = $inputChannel;    
78 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
         }  
Please login to merge, or discard this patch.
src/ABS/Handler/ReplyProducingMessageHandler.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * Connects the handler to the output-channel. 
54 54
      * 
55 55
      * @access protected
56
-     * @param \PEIP\INF\Channel\Channel $inputChannel the output-channel to connect the handler to
56
+     * @param \PEIP\INF\Channel\Channel $outputChannel the output-channel to connect the handler to
57 57
      * @return 
58 58
      */
59 59
     protected function doSetOutputChannel(\PEIP\INF\Channel\Channel $outputChannel){
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * 
163 163
      * @access public
164 164
      * @param string $messageClass name of the message-class to create reply-messages from. 
165
-     * @return PEIP\ABS\Handler\ReplyProducingMessageHandler $this
165
+     * @return ReplyProducingMessageHandler $this
166 166
      */
167 167
     public function setMessageClass($messageClass){
168 168
         $this->messageClass = $messageClass;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      * 
196 196
      * @access public
197 197
      * @param array $headerNames array of message-header names to look for a reply-channel
198
-     * @return PEIP\ABS\Handler\ReplyProducingMessageHandler $this
198
+     * @return ReplyProducingMessageHandler $this
199 199
      */
200 200
     public function setReplyChannelHeaders(array $headerNames){
201 201
         $this->replyChannelHeaders = $headerNames;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param \PEIP\INF\Channel\Channel $outputChannel the output-channel
45 45
      * @return \PEIP\ABS\Handler\MessageHandler $this;
46 46
      */
47
-    public function setOutputChannel(\PEIP\INF\Channel\Channel $outputChannel){
47
+    public function setOutputChannel(\PEIP\INF\Channel\Channel $outputChannel) {
48 48
         $this->doSetOutputChannel($outputChannel);
49 49
         return $this;
50 50
     }   
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param \PEIP\INF\Channel\Channel $inputChannel the output-channel to connect the handler to
57 57
      * @return 
58 58
      */
59
-    protected function doSetOutputChannel(\PEIP\INF\Channel\Channel $outputChannel){
59
+    protected function doSetOutputChannel(\PEIP\INF\Channel\Channel $outputChannel) {
60 60
         $this->outputChannel = $outputChannel;
61 61
     }
62 62
        
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @access public
67 67
      * @return \PEIP\INF\Channel\Channel output-channel for this handler
68 68
      */
69
-    public function getOutputChannel(){
69
+    public function getOutputChannel() {
70 70
         return $this->outputChannel;
71 71
     }
72 72
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @param \PEIP\INF\Message\Message $message the message to resolve output-channel for
81 81
      * @return \PEIP\INF\Channel\Channel the output-channel for the message
82 82
      */    
83
-    protected function doGetOutputChannel(\PEIP\INF\Message\Message $message){
83
+    protected function doGetOutputChannel(\PEIP\INF\Message\Message $message) {
84 84
         $replyChannel = $this->resolveReplyChannel($message);
85 85
         return $replyChannel ? $replyChannel : $this->getOutputChannel();       
86 86
     }
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
      * @param \PEIP\INF\Message\Message $message 
95 95
      * @return \PEIP\INF\Channel\Channel the reply-channel if found
96 96
      */     
97
-    protected function resolveReplyChannel(\PEIP\INF\Message\Message $message){
98
-        foreach($this->replyChannelHeaders as $header){
99
-            if($message->hasHeader($header)){
97
+    protected function resolveReplyChannel(\PEIP\INF\Message\Message $message) {
98
+        foreach ($this->replyChannelHeaders as $header) {
99
+            if ($message->hasHeader($header)) {
100 100
                 return $message->getHeader($header);
101 101
             }
102 102
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @access protected
114 114
      * @param mixed $content \PEIP\INF\Message\Message or content/payload for new message 
115 115
      */
116
-    protected function replyMessage($content){
116
+    protected function replyMessage($content) {
117 117
         $message = $this->ensureMessage($content);      
118 118
         $this->doGetOutputChannel($message)->send($message);      
119 119
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      * @param mixed $message \PEIP\INF\Message\Message or content/payload for new message
128 128
      * @return \PEIP\INF\Message\Message
129 129
      */
130
-    protected function ensureMessage($message){
130
+    protected function ensureMessage($message) {
131 131
         return ($message instanceof \PEIP\INF\Message\Message) ? $message : $this->buildMessage($message);   
132 132
     }
133 133
        
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      * @return \PEIP\INF\Message\Message
141 141
      * @see MessageBuilder
142 142
      */
143
-    protected function buildMessage($content){
143
+    protected function buildMessage($content) {
144 144
         return $this->getMessageBuilder()->setContent($content)->build();   
145 145
     }   
146 146
        
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      * @access protected
152 152
      * @return MessageBuilder builder for the registered message class
153 153
      */
154
-    protected function getMessageBuilder(){
154
+    protected function getMessageBuilder() {
155 155
         return isset($this->messageBuilder) && ($this->messageBuilder->getMessageClass() == $this->getMessageClass())
156 156
             ? $this->messageBuilder
157 157
             : $this->messageBuilder = MessageBuilder::getInstance($this->messageClass);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      * @param string $messageClass name of the message-class to create reply-messages from. 
165 165
      * @return PEIP\ABS\Handler\ReplyProducingMessageHandler $this
166 166
      */
167
-    public function setMessageClass($messageClass){
167
+    public function setMessageClass($messageClass) {
168 168
         $this->messageClass = $messageClass;
169 169
         return $this;
170 170
     }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @access public
176 176
      * @return string name of the message-class to create reply-messages from. 
177 177
      */
178
-    public function getMessageClass(){
178
+    public function getMessageClass() {
179 179
         return $this->messageClass;
180 180
     }       
181 181
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      * @param string $headerName name of a message-header to look for a reply-channel
187 187
      * @return void
188 188
      */
189
-    public function addReplyChannelHeader($headerName){
189
+    public function addReplyChannelHeader($headerName) {
190 190
         $this->replyChannelHeaders[] = $headerName;
191 191
     }
192 192
     
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * @param array $headerNames array of message-header names to look for a reply-channel
198 198
      * @return PEIP\ABS\Handler\ReplyProducingMessageHandler $this
199 199
      */
200
-    public function setReplyChannelHeaders(array $headerNames){
200
+    public function setReplyChannelHeaders(array $headerNames) {
201 201
         $this->replyChannelHeaders = $headerNames;
202 202
         return $this;
203 203
     } 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @access public
209 209
      * @return array array of message-header names to look for a reply-channel
210 210
      */
211
-    public function getReplyChannelHeaders(){
211
+    public function getReplyChannelHeaders() {
212 212
         return $this->replyChannelHeaders;
213 213
     }
214 214
          
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      * @param \PEIP\INF\Message\Message $message 
223 223
      * @return 
224 224
      */
225
-    protected function doHandle(\PEIP\INF\Message\Message $message){
225
+    protected function doHandle(\PEIP\INF\Message\Message $message) {
226 226
         return $this->doReply($message);
227 227
     }
228 228
        
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
  * @implements \PEIP\INF\Gateway\MessagingGateway, \PEIP\INF\Message\MessageBuilder
21 21
  */
22 22
 
23
-use PEIP\Message\GenericMessage;
23
+use PEIP\Message\GenericMessage;
24 24
 use PEIP\Message\MessageBuilder;
25 25
 
26 26
 class SimpleMessagingGateway 
Please login to merge, or discard this patch.
src/Autoload/Autoload.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,8 @@
 block discarded – undo
66 66
      * Scans a directory recursively for php-files and adds them to autoload
67 67
      * 
68 68
      * @access public
69
-     * @param string directoy to scan
69
+     * @param string directoy to scan
70
+     * @param string $dir
70 71
      * @return void
71 72
      */ 
72 73
     public function scanDirectory($dir){
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * 
34 34
      * @access protected
35 35
      */ 
36
-    protected function __construct(){
36
+    protected function __construct() {
37 37
         $this->init();
38 38
         require_once(dirname(__FILE__).'/AutoloadPaths.php');
39 39
         $this->setClassPaths(AutoloadPaths::$paths);
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
      * @static
47 47
      * @return Autoload
48 48
      */     
49
-    static public function getInstance(){ 
50
-        if (!isset(self::$instance)){
49
+    static public function getInstance() { 
50
+        if (!isset(self::$instance)) {
51 51
             self::$instance = new Autoload();
52 52
         }
53 53
         return self::$instance;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @access protected
59 59
      * @return Autoload
60 60
      */
61
-    protected static function doGetInstance(){
61
+    protected static function doGetInstance() {
62 62
         return self::$instance = new Autoload();   
63 63
     }       
64 64
  
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
      * @param string directoy to scan
70 70
      * @return void
71 71
      */ 
72
-    public function scanDirectory($dir){
73
-        if(is_dir($dir)){ 
72
+    public function scanDirectory($dir) {
73
+        if (is_dir($dir)) { 
74 74
             $this->addClassPaths($this->findPaths(NULL, new RecursiveDirectoryIterator($dir)));
75 75
         }
76 76
     } 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @static
83 83
      * @return void
84 84
      */ 
85
-    public static function make(){
85
+    public static function make() {
86 86
         $baseDir = self::getBaseDirectory();
87 87
         $iterator = new RecursiveDirectoryIterator($baseDir);
88 88
         $paths = self::findPaths($baseDir, $iterator);
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
      * @param array $paths the array to store the class/path associations in.
103 103
      * @return Autoload
104 104
      */ 
105
-    protected static function findPaths($baseDir, RecursiveDirectoryIterator $iterator, array $paths = array()){
105
+    protected static function findPaths($baseDir, RecursiveDirectoryIterator $iterator, array $paths = array()) {
106 106
         $iterator->rewind();
107
-        while($iterator->valid()){
108
-            if($iterator->isDir() && !$iterator->isDot()){
107
+        while ($iterator->valid()) {
108
+            if ($iterator->isDir() && !$iterator->isDot()) {
109 109
                 $paths = self::findPaths($baseDir, $iterator->getChildren(), $paths);
110
-            }elseif($iterator->isFile() && strrchr($iterator->getFilename(), '.') == '.php'){
110
+            }elseif ($iterator->isFile() && strrchr($iterator->getFilename(), '.') == '.php') {
111 111
                 $class = $iterator->getBasename('.php');
112 112
                 $paths[$class] = str_replace($baseDir, '', $iterator->getPathName());                       
113 113
             }
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
      * @param string $class the class to load
125 125
      * @return path to the class-file 
126 126
      */     
127
-    public function autoload($class){ 
128
-        if(!$this->getClassPath($class)){
127
+    public function autoload($class) { 
128
+        if (!$this->getClassPath($class)) {
129 129
             $this->scanDirectory(realpath(dirname(__FILE__).'/../extensions')); 
130 130
         }
131 131
         parent::autoload($class);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
         while($iterator->valid()){
108 108
             if($iterator->isDir() && !$iterator->isDot()){
109 109
                 $paths = self::findPaths($baseDir, $iterator->getChildren(), $paths);
110
-            }elseif($iterator->isFile() && strrchr($iterator->getFilename(), '.') == '.php'){
110
+            } elseif($iterator->isFile() && strrchr($iterator->getFilename(), '.') == '.php'){
111 111
                 $class = $iterator->getBasename('.php');
112 112
                 $paths[$class] = str_replace($baseDir, '', $iterator->getPathName());                       
113 113
             }
Please login to merge, or discard this patch.
src/Base/GenericBuilder.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      * 
40 40
      * @access public
41 41
      * @param string $className class-name to create objects for
42
-     * @param ReflectionClass $reflectionClass reflection-class for class. default: NULL 
42
+     * @param \ReflectionClass $reflectionClass reflection-class for class. default: NULL 
43 43
      * @param boolean $storeRef wether to store a reference for new instance. default: true 
44 44
      * @return 
45 45
      */
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
      * @param boolean $storeRef wether to store a reference for new instance. default: true 
44 44
      * @return 
45 45
      */
46
-    public function __construct($className, \ReflectionClass $reflectionClass = NULL, $storeRef = true){
47
-        if($reflectionClass ){
46
+    public function __construct($className, \ReflectionClass $reflectionClass = NULL, $storeRef = true) {
47
+        if ($reflectionClass) {
48 48
             
49
-            if($reflectionClass->getName() != $className){
49
+            if ($reflectionClass->getName() != $className) {
50 50
                 throw new \Exception(
51 51
                     'Constructing GenericBuilder with wrong ReflectionClass'
52 52
                 );
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $this->reflectionClass = $reflectionClass;
57 57
         }
58 58
         $this->className = $className;
59
-        if($storeRef){
59
+        if ($storeRef) {
60 60
             self::$instances[$this->className] = $this;
61 61
         }            
62 62
     }
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      * @param string $className class-name to return builder instance for 
69 69
      * @return GenericBuilder builder instance for class
70 70
      */
71
-    public static function getInstance($className){
72
-        if(!array_key_exists((string)$className, self::$instances)) {
71
+    public static function getInstance($className) {
72
+        if (!array_key_exists((string)$className, self::$instances)) {
73 73
             new GenericBuilder($className);
74 74
         }
75 75
         return self::$instances[$className];
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
      * @param array $arguments array of constructore arguments
83 83
      * @return object the created object instance
84 84
      */
85
-    public function build(array $arguments = array()){      
86
-        if(Test::assertClassHasConstructor($this->className)){
87
-            if(!Test::assertRequiredConstructorParameters($this->className, $arguments)){
85
+    public function build(array $arguments = array()) {      
86
+        if (Test::assertClassHasConstructor($this->className)) {
87
+            if (!Test::assertRequiredConstructorParameters($this->className, $arguments)) {
88 88
                 throw new \Exception('Missing Argument '.(count($arguments) + 1).' for '.$this->className.'::__construct');
89 89
             }
90 90
             return $this->getReflectionClass()->newInstanceArgs($arguments);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      * @access public
99 99
      * @return ReflectionClass
100 100
      */
101
-    public function getReflectionClass(){
101
+    public function getReflectionClass() {
102 102
         return ReflectionPool::getInstance($this->className);
103 103
     }
104 104
     
Please login to merge, or discard this patch.
src/Context/XMLContext.php 5 patches
Doc Comments   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -174,7 +174,6 @@  discard block
 block discarded – undo
174 174
      * </config>     
175 175
      * 
176 176
      * @access public
177
-     * @param XMLContext $config the config to include
178 177
      */    
179 178
     public function includeContext(XMLContext $context){
180 179
         $this->services = array_merge($this->services, $context->getServices());
@@ -185,7 +184,7 @@  discard block
 block discarded – undo
185 184
      * 
186 185
      * @see XMLContext::includeContext
187 186
      * @access public
188
-     * @param XMLContext $context the config to include
187
+     * @param string $filePath
189 188
      */    
190 189
     public function includeContextFromFile($filePath){
191 190
         if(file_exists($filePath)){
@@ -693,7 +692,7 @@  discard block
 block discarded – undo
693 692
      * 
694 693
      * @access protected
695 694
      * @param object $config configuration object to create arguments from.  
696
-     * @return mixed build arguments 
695
+     * @return \PEIP\INF\Channel\Channel[] build arguments 
697 696
      */
698 697
     protected function getReplyHandlerArguments($config){
699 698
         $args = array(
@@ -738,7 +737,8 @@  discard block
 block discarded – undo
738 737
      * 
739 738
      * @access protected
740 739
      * @param string the configuration type ofthe channel (e.g.: 'reply', 'request')
741
-     * @param object $config configuration object to return channel from. 
740
+     * @param object $config configuration object to return channel from.
741
+     * @param string $type 
742 742
      * @return \PEIP\INF\Channel\Channel reply-channel
743 743
      */
744 744
     public function doGetChannel($type, $config){
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
      * @see GenericBuilder
834 834
      * @static
835 835
      * @access protected
836
-     * @param object $className name of class to build instance for. 
836
+     * @param string $className name of class to build instance for. 
837 837
      * @param array $arguments arguments for the constructor 
838 838
      * @return object build and modified srvice instance
839 839
      */     
@@ -841,6 +841,10 @@  discard block
 block discarded – undo
841 841
         return GenericBuilder::getInstance($className)->build($arguments);
842 842
     }
843 843
 
844
+    /**
845
+     * @param string $type
846
+     * @param string $name
847
+     */
844 848
     protected static function hasPublicProperty($service, $type, $name){
845 849
         $reflection = GenericBuilder::getInstance(get_class($service))->getReflectionClass();
846 850
         if($reflection->{'has'.$type}($name) && $reflection->{'get'.$type}($name)->isPublic()){
Please login to merge, or discard this patch.
Unused Use Statements   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
  */
23 23
 
24 24
 
25
-use PEIP\Handler\CallableHandler;
26
-use PEIP\Service\HeaderServiceActivator;
27
-use PEIP\Channel\ChannelRegistry;
28
-use PEIP\Service\ServiceProvider;
29
-use PEIP\Plugins\BasePlugin;
30
-use PEIP\Factory\ServiceFactory;
31
-use PEIP\Base\GenericBuilder;
32
-use PEIP\Channel\PollableChannel;
33
-use PEIP\Channel\PublishSubscribeChannel;
34
-use PEIP\Gateway\SimpleMessagingGateway;
35
-use PEIP\Listener\Wiretap;
25
+use PEIP\Handler\CallableHandler;
26
+use PEIP\Service\HeaderServiceActivator;
27
+use PEIP\Channel\ChannelRegistry;
28
+use PEIP\Service\ServiceProvider;
29
+use PEIP\Plugins\BasePlugin;
30
+use PEIP\Factory\ServiceFactory;
31
+use PEIP\Base\GenericBuilder;
32
+use PEIP\Channel\PollableChannel;
33
+use PEIP\Channel\PublishSubscribeChannel;
34
+use PEIP\Gateway\SimpleMessagingGateway;
35
+use PEIP\Listener\Wiretap;
36 36
 use PEIP\Service\ServiceActivator;
37 37
 
38 38
 class XMLContext 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      * @param callable $callable a callable which creates instances for node-name 
135 135
      */
136 136
     public function registerNodeBuilder($nodeName, $callable){
137
-       return  $this->getServiceProvider()->registerNodeBuilder($nodeName, $callable);
137
+        return  $this->getServiceProvider()->registerNodeBuilder($nodeName, $callable);
138 138
     }
139 139
    
140 140
     /**
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
      */
770 770
     public function buildAndModify($config, $arguments, $defaultClass = false){
771 771
         if("" != (string)$config["class"]  || $defaultClass){
772
-             $service = ServiceFactory::doBuild($config, $arguments, $defaultClass);
772
+                $service = ServiceFactory::doBuild($config, $arguments, $defaultClass);
773 773
         }elseif($config["ref"]){
774 774
             $service = $this->getService((string)$config['ref']);
775 775
         }else{
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -55,26 +55,26 @@  discard block
 block discarded – undo
55 55
      * @param string $string the configuration string 
56 56
      * @return 
57 57
      */
58
-    public function __construct($string){
58
+    public function __construct($string) {
59 59
         $this->initNodeBuilders();
60 60
         $reader = new XMLContext_Reader($string);
61 61
         $provider = $this->getServiceProvider();
62 62
 
63
-        $handler =  new CallableHandler($callable);
63
+        $handler = new CallableHandler($callable);
64 64
 
65 65
         $serviceActivator = new HeaderServiceActivator(array($this, 'addConfig'), 'NODE');
66 66
 
67
-        $reader->connect('read_node',  $serviceActivator);
67
+        $reader->connect('read_node', $serviceActivator);
68 68
         $reader->read();
69 69
 
70 70
        
71 71
     }
72 72
 
73
-    public function addConfig($config){
73
+    public function addConfig($config) {
74 74
         return $this->getServiceProvider()->addConfig($config);
75 75
     }
76 76
 
77
-    public function handleReadConfig(\PEIP\INF\Event\Event $event){
77
+    public function handleReadConfig(\PEIP\INF\Event\Event $event) {
78 78
         $this->addConfig($event->getHeader('NODE'));
79 79
     }
80 80
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @return XMLContext the context instance
87 87
      * @throws RuntimeException 
88 88
      */      
89
-    public static function createFromString($string){
89
+    public static function createFromString($string) {
90 90
         return new XMLContext($string);
91 91
     }
92 92
 
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
      * @return XMLContext the context instance
99 99
      * @throws RuntimeException 
100 100
      */    
101
-    public static function createFromFile($file){
102
-        if(file_exists($file)){
101
+    public static function createFromFile($file) {
102
+        if (file_exists($file)) {
103 103
             return self::createFromString(file_get_contents($file));
104
-        }else{
104
+        }else {
105 105
             throw new \RuntimeException('Cannot open file  "'.$file.'".');
106 106
         }
107 107
     }
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
      * @access protected
113 113
      * @return void
114 114
      */
115
-    protected function init(){
115
+    protected function init() {
116 116
         $xml = $this->simpleXML;
117 117
         $this->channelRegistry = ChannelRegistry::getInstance();
118 118
         // register this context as a service if id is set.
119
-        if($xml['id']){
119
+        if ($xml['id']) {
120 120
             $this->services[(string)$xml['id']] = $this;    
121 121
         }
122 122
         // build services
123
-        foreach($xml->children() as $entry){
123
+        foreach ($xml->children() as $entry) {
124 124
             $this->buildNode($entry);
125 125
         }
126 126
     }    
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      * @param string $nodeName the name of the node 
134 134
      * @param callable $callable a callable which creates instances for node-name 
135 135
      */
136
-    public function registerNodeBuilder($nodeName, $callable){
136
+    public function registerNodeBuilder($nodeName, $callable) {
137 137
        return  $this->getServiceProvider()->registerNodeBuilder($nodeName, $callable);
138 138
     }
139 139
    
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      * @access public
145 145
      * @param \PEIP\INF\Context\Context_Plugin $plugin a plugin instance
146 146
      */
147
-    public function addPlugin(\PEIP\INF\Context\Context_Plugin $plugin){ 
147
+    public function addPlugin(\PEIP\INF\Context\Context_Plugin $plugin) { 
148 148
         $plugin->init($this);   
149 149
     }
150 150
   
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @param object $config configuration object for the plugin 
156 156
      * @return 
157 157
      */
158
-    public function createPlugin($config){
158
+    public function createPlugin($config) {
159 159
         $plugin = $this->createService($config);    
160 160
         $this->addPlugin($plugin);
161 161
     }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      * @access public
177 177
      * @param XMLContext $config the config to include
178 178
      */    
179
-    public function includeContext(XMLContext $context){
179
+    public function includeContext(XMLContext $context) {
180 180
         $this->services = array_merge($this->services, $context->getServices());
181 181
     }
182 182
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
      * @access public
188 188
      * @param XMLContext $context the config to include
189 189
      */    
190
-    public function includeContextFromFile($filePath){
191
-        if(file_exists($filePath)){
190
+    public function includeContextFromFile($filePath) {
191
+        if (file_exists($filePath)) {
192 192
             $this->includeContextFromString(file_get_contents($filePath));
193 193
         }           
194 194
     }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @access public
201 201
      * @param string $configString the config to include
202 202
      */    
203
-    public function includeContextFromString($configString){
203
+    public function includeContextFromString($configString) {
204 204
         $context = new XMLContext($configString);
205 205
         $this->includeContext($context);            
206 206
     }   
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
      * @access protected
213 213
      * @param object $config the configuration for the context
214 214
      */    
215
-    protected function createContext($config){
216
-        if((string)$config['file'] != ''){
215
+    protected function createContext($config) {
216
+        if ((string)$config['file'] != '') {
217 217
             $this->includeContextFromFile((string)$config['file']);
218 218
         }           
219 219
     }   
220 220
      
221 221
 
222
-    public function getServiceProvider(){
222
+    public function getServiceProvider() {
223 223
         return isset($this->serviceProvider)
224 224
             ? $this->serviceProvider
225 225
             : $this->serviceProvider = new ServiceProvider();
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @see XMLContext::includeContext
236 236
      * @access protected
237 237
      */     
238
-    protected function initNodeBuilders(){
238
+    protected function initNodeBuilders() {
239 239
         $builders = array(
240 240
             'include' => 'createContext',
241 241
             'plugin' => 'createPlugin',
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         );
254 254
         $plugin = new BasePlugin();
255 255
         $this->addPlugin($plugin); return;
256
-        foreach($builders as $nodeName => $method){
256
+        foreach ($builders as $nodeName => $method) {
257 257
             $this->registerNodeBuilder($nodeName, array($this, $method));   
258 258
         }       
259 259
     }
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
      * @param object $node configuration-node
268 268
      * @return void
269 269
      */
270
-    protected function buildNode($node){
270
+    protected function buildNode($node) {
271 271
         $nodeName = $node->getName();
272 272
         // call the builder method registered for the node.
273
-        if(array_key_exists($nodeName, $this->nodeBuilders)){
273
+        if (array_key_exists($nodeName, $this->nodeBuilders)) {
274 274
             call_user_func($this->nodeBuilders[$nodeName], $node);
275 275
         }           
276 276
     }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      * @param string $channelName the name/id of the channel to return 
290 290
      * @return \PEIP\INF\Channel\Channel
291 291
      */
292
-    public function resolveChannelName($channelName){
292
+    public function resolveChannelName($channelName) {
293 293
         return $this->channelRegistry->get($channelName);
294 294
     }   
295 295
      
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      * @param mixed $id the id for the service
302 302
      * @return object the service instance if found
303 303
      */
304
-    public function getService($id){     
304
+    public function getService($id) {     
305 305
         return $this->getServiceProvider()->provideService($id);
306 306
     }
307 307
              
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      * @access public
312 312
      * @return array registered services
313 313
      */
314
-    public function getServices(){    
314
+    public function getServices() {    
315 315
         return $this->getServiceProvider()->getServices();
316 316
     }  
317 317
     
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      * @param mixed $id the id for the service 
323 323
      * @return boolean wether service is registered
324 324
      */
325
-    public function hasService($id){
325
+    public function hasService($id) {
326 326
         return isset($this->services[$id]);
327 327
     }
328 328
       
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
      * @return object the service instance if found
337 337
      * 
338 338
      */
339
-    protected function requestService($id){
339
+    protected function requestService($id) {
340 340
         $service = $this->getService($id);
341
-        if($service === NULL){
341
+        if ($service === NULL) {
342 342
             throw new \RuntimeException('Service "'.$id.'" not found.');
343 343
         } 
344 344
         return $service;
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
      * @param object $config 
353 353
      * @return object the initialized service instance
354 354
      */
355
-    protected function initService($config){
355
+    protected function initService($config) {
356 356
         $id = trim((string)$config['id']);
357
-        if($id != ''){
357
+        if ($id != '') {
358 358
             return $this->services[$id] = $this->createService($config);    
359 359
         }   
360 360
     }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
      * @param $config 
367 367
      * @return object the initialized service instance
368 368
      */
369
-    public function createService($config){
369
+    public function createService($config) {
370 370
         return ServiceFactory::createService($config);      
371 371
     }
372 372
  
@@ -383,29 +383,29 @@  discard block
 block discarded – undo
383 383
      * @param object $config configuration to get the modification instructions from. 
384 384
      * @return object the modificated service
385 385
      */
386
-    protected function modifyService($service, $config){ 
386
+    protected function modifyService($service, $config) { 
387 387
         $reflection = GenericBuilder::getInstance(get_class($service))->getReflectionClass();
388 388
         // set instance properties
389
-        if($config->property){          
390
-            foreach($config->property as $property){                          
389
+        if ($config->property) {          
390
+            foreach ($config->property as $property) {                          
391 391
                 $arg = $this->buildArg($property);
392
-                if($arg){
392
+                if ($arg) {
393 393
                     $setter = self::getSetter($property);               
394
-                    if($setter &&  self::hasPublicProperty($service, 'Method', $setter)){
394
+                    if ($setter && self::hasPublicProperty($service, 'Method', $setter)) {
395 395
                         $service->{$setter}($arg);  
396
-                    }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){
396
+                    }elseif (in_array($property, self::hasPublicProperty($service, 'Property', $setter))) {
397 397
                         $service->$setter = $arg;
398 398
                     }                   
399 399
                 }
400 400
             }
401 401
         }   
402 402
         // call instance methods
403
-        if($config->action){            
404
-            foreach($config->action as $action){
403
+        if ($config->action) {            
404
+            foreach ($config->action as $action) {
405 405
                 $method = (string)$action['method'] != '' ? (string)$action['method'] : NULL;
406
-                if($method && self::hasPublicProperty($service, 'Method', $method)){
406
+                if ($method && self::hasPublicProperty($service, 'Method', $method)) {
407 407
                     $args = array(); 
408
-                    foreach($action->children() as $argument){
408
+                    foreach ($action->children() as $argument) {
409 409
                         $args[] = $this->buildArg($argument);
410 410
                     } 
411 411
                     call_user_func_array(array($service, (string)$action['method']), $args);
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
             }
414 414
         }       
415 415
         // register instance listeners
416
-        if($service instanceof \PEIP\INF\Event\Connectable){
417
-            if($config->listener){
418
-                foreach($config->listener as $listenerConf){
416
+        if ($service instanceof \PEIP\INF\Event\Connectable) {
417
+            if ($config->listener) {
418
+                foreach ($config->listener as $listenerConf) {
419 419
                     $event = (string)$listenerConf['event'];
420 420
                     $listener = $this->provideService($listenerConf);  
421 421
                     $service->connect($event, $listener);   
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      * @param mixed $id the id ofthe gateway 
435 435
      * @return object the gateway instance
436 436
      */
437
-    public function getGateway($id){
437
+    public function getGateway($id) {
438 438
         return $this->services[$id];
439 439
     }   
440 440
   
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      * @param object $config configuration object for the pollable channel. 
447 447
      * @return \PEIP\INF\Channel\Channel the created pollable channel instance
448 448
      */
449
-    public function createChannel($config){
449
+    public function createChannel($config) {
450 450
         return $this->doCreateChannel($config, 'PollableChannel');        
451 451
     }
452 452
   
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
      * @param object $config configuration object for the subscribable channel. 
459 459
      * @return \PEIP\INF\Channel\Channel the created subscribable channel instance
460 460
      */
461
-    public function createSubscribableChannel($config){
461
+    public function createSubscribableChannel($config) {
462 462
         return $this->doCreateChannel($config, 'PublishSubscribeChannel');       
463 463
     }   
464 464
    
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
      * @param $additionalArguments additional arguments for the channel constructor (without first arg = id)
472 472
      * @return \PEIP\INF\Channel\Channel the created channel instance
473 473
      */
474
-    public function doCreateChannel($config, $defaultChannelClass, array $additionalArguments = array()){
474
+    public function doCreateChannel($config, $defaultChannelClass, array $additionalArguments = array()) {
475 475
         $id = (string)$config['id'];
476
-        if($id != ''){ 
476
+        if ($id != '') { 
477 477
             array_unshift($additionalArguments, $id);
478 478
             $channel = $this->buildAndModify($config, $additionalArguments, $defaultChannelClass);
479 479
             $this->channelRegistry->register($channel);
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      * @param string $defaultClass the class to use if none is set in config. 
491 491
      * @return object the gateway instance
492 492
      */
493
-    public function createGateway($config, $defaultClass = false){
493
+    public function createGateway($config, $defaultClass = false) {
494 494
         $args = array(
495 495
             $this->getRequestChannel($config), 
496 496
             $this->getReplyChannel($config)
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
      * @param string $defaultClass the class to use if none is set in config. 
515 515
      * @return object the router instance
516 516
      */
517
-    public function createRouter($config, $defaultClass = false){
517
+    public function createRouter($config, $defaultClass = false) {
518 518
         $resolver = $config['channel_resolver'] ? (string)$config['channel_resolver'] : $this->channelRegistry;
519 519
         return $this->buildAndModify($config, array(
520 520
             $resolver,
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
      * @param object $config configuration object for the splitter. 
532 532
      * @return object the splitter instance
533 533
      */    
534
-    public function createSplitter($config){
534
+    public function createSplitter($config) {
535 535
         return $this->createReplyMessageHandler($config);           
536 536
     }   
537 537
  
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
      * @param object $config configuration object for the transformer. 
545 545
      * @return object the transformer instance
546 546
      */    
547
-    public function createTransformer($config){
547
+    public function createTransformer($config) {
548 548
         return $this->createReplyMessageHandler($config);           
549 549
     } 
550 550
       
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
      * @param object $config configuration object for the aggregator. 
558 558
      * @return object the aggregator instance
559 559
      */  
560
-    public function createAggregator($config){
560
+    public function createAggregator($config) {
561 561
         return $this->createReplyMessageHandler($config);       
562 562
     }
563 563
   
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
      * @param object $config configuration object for the wiretap. 
571 571
      * @return object the wiretap instance
572 572
      */ 
573
-    public function createWiretap($config){
573
+    public function createWiretap($config) {
574 574
         return $this->createReplyMessageHandler($config, 'Wiretap');       
575 575
     }
576 576
   
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
      * @param string $defaultClass the class to use if none is set in config.
584 584
      * @return object the reply-message-handler instance
585 585
      */ 
586
-    public function createReplyMessageHandler($config, $defaultClass = false){
586
+    public function createReplyMessageHandler($config, $defaultClass = false) {
587 587
         return $this->buildAndModify($config, $this->getReplyHandlerArguments($config), $defaultClass); 
588 588
     }
589 589
     
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
      * @param string $defaultClass the class to use if none is set in config. 
597 597
      * @return object the service-activator instance
598 598
      */
599
-    public function createServiceActivator($config, $defaultClass = false){
599
+    public function createServiceActivator($config, $defaultClass = false) {
600 600
         $method = (string)$config['method'];
601 601
         $service = $this->getService((string)$config['ref']);
602
-        if($method && $service){        
602
+        if ($method && $service) {        
603 603
             $args = $this->getReplyHandlerArguments($config);
604
-            array_unshift($args,array(
604
+            array_unshift($args, array(
605 605
                 $service,
606 606
                 $method             
607 607
             )); 
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
      * @param object $config configuration object for the service. 
623 623
      * @return 
624 624
      */
625
-    protected function provideService($config){
625
+    protected function provideService($config) {
626 626
         $ref = trim((string)$config['ref']);
627
-        if($ref != ''){
627
+        if ($ref != '') {
628 628
             $service = $this->getService($ref); 
629
-        }else{
629
+        }else {
630 630
             $service = $this->createService($config);
631 631
         }
632 632
         return $service;
@@ -643,10 +643,10 @@  discard block
 block discarded – undo
643 643
      * @param object $config configuration object for the setter-method. 
644 644
      * @return string camel-cased 
645 645
      */    
646
-    protected static function getSetter($config){
647
-        if($config['setter']){
646
+    protected static function getSetter($config) {
647
+        if ($config['setter']) {
648 648
             $setter = (string)$config['setter'];
649
-        }elseif($config['name']){
649
+        }elseif ($config['name']) {
650 650
             $setter = 'set'.ucfirst((string)$config['name']);   
651 651
         }
652 652
         return $setter;     
@@ -659,29 +659,29 @@  discard block
 block discarded – undo
659 659
      * @param object $config configuration object to create argument from.  
660 660
      * @return mixed build argument 
661 661
      */
662
-    protected function buildArg($config){ 
663
-        if(trim((string)$config['value']) != ''){
662
+    protected function buildArg($config) { 
663
+        if (trim((string)$config['value']) != '') {
664 664
             $arg = (string)$config['value'];
665
-        }elseif($config->getName() == 'value'){
665
+        }elseif ($config->getName() == 'value') {
666 666
             $arg = (string)$config;
667
-        }elseif($config->getName() == 'list'){
667
+        }elseif ($config->getName() == 'list') {
668 668
             $arg = array();
669
-            foreach($config->children() as $entry){ 
670
-                if($entry->getName() == 'value'){
671
-                    if($entry['key']){
669
+            foreach ($config->children() as $entry) { 
670
+                if ($entry->getName() == 'value') {
671
+                    if ($entry['key']) {
672 672
                         $arg[(string)$entry['key']] = (string)$entry;   
673
-                    }else{
673
+                    }else {
674 674
                         $arg[] = (string)$entry;
675 675
                     }
676
-                }elseif($entry->getName() == 'service'){
676
+                }elseif ($entry->getName() == 'service') {
677 677
                     $arg[] = $this->provideService($entry);
678 678
                 }
679 679
             }
680
-        }elseif($config->getName() == 'service'){
680
+        }elseif ($config->getName() == 'service') {
681 681
             $arg = $this->provideService($config);
682
-        }elseif($config->list){
682
+        }elseif ($config->list) {
683 683
             $arg = $this->buildArg($config->list);
684
-        }elseif($config->service){
684
+        }elseif ($config->service) {
685 685
             $arg = $this->buildArg($config->service);
686 686
         } 
687 687
         return $arg; 
@@ -695,12 +695,12 @@  discard block
 block discarded – undo
695 695
      * @param object $config configuration object to create arguments from.  
696 696
      * @return mixed build arguments 
697 697
      */
698
-    protected function getReplyHandlerArguments($config){
698
+    protected function getReplyHandlerArguments($config) {
699 699
         $args = array(
700 700
             $this->doGetChannel('input', $config),
701 701
             $this->doGetChannel('output', $config)
702 702
         );
703
-        if($args[0] == NULL){
703
+        if ($args[0] == NULL) {
704 704
             throw new \RuntimeException('Could not receive input channel.');
705 705
         }
706 706
         return $args;
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
      * @param object $config configuration object to return request-channel from. 
716 716
      * @return \PEIP\INF\Channel\Channel request-channel
717 717
      */
718
-    protected function getRequestChannel($config){
718
+    protected function getRequestChannel($config) {
719 719
         return $this->doGetChannel('request', $config); 
720 720
     }
721 721
     
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
      * @param object $config configuration object to return reply-channel from. 
729 729
      * @return \PEIP\INF\Channel\Channel reply-channel
730 730
      */
731
-    protected function getReplyChannel($config){
731
+    protected function getReplyChannel($config) {
732 732
         return $this->doGetChannel('reply', $config);   
733 733
     }
734 734
     
@@ -741,15 +741,15 @@  discard block
 block discarded – undo
741 741
      * @param object $config configuration object to return channel from. 
742 742
      * @return \PEIP\INF\Channel\Channel reply-channel
743 743
      */
744
-    public function doGetChannel($type, $config){
744
+    public function doGetChannel($type, $config) {
745 745
         $channelName = $config[$type."_channel"] 
746 746
             ? $config[$type."_channel"] 
747 747
             : $config["default_".$type."_channel"];
748 748
         return $this->serviceProvider->provideService(trim((string)$channelName));
749
-        $channel =  $this->services[trim((string)$channelName)];
750
-        if($channel instanceof \PEIP\INF\Channel\Channel){
749
+        $channel = $this->services[trim((string)$channelName)];
750
+        if ($channel instanceof \PEIP\INF\Channel\Channel) {
751 751
             return $channel;    
752
-        }else{
752
+        }else {
753 753
             return NULL;
754 754
         }       
755 755
     }
@@ -767,31 +767,31 @@  discard block
 block discarded – undo
767 767
      * @param string $defaultClass class to create instance for if none is set in config 
768 768
      * @return object build and modified srvice instance
769 769
      */
770
-    public function buildAndModify($config, $arguments, $defaultClass = false){
771
-        if("" != (string)$config["class"]  || $defaultClass){
770
+    public function buildAndModify($config, $arguments, $defaultClass = false) {
771
+        if ("" != (string)$config["class"] || $defaultClass) {
772 772
              $service = ServiceFactory::doBuild($config, $arguments, $defaultClass);
773
-        }elseif($config["ref"]){
773
+        }elseif ($config["ref"]) {
774 774
             $service = $this->getService((string)$config['ref']);
775
-        }else{
775
+        }else {
776 776
             throw new \RuntimeException('Could not create Service. no class or reference given.');
777 777
         }
778
-        if($config["ref_property"]){
778
+        if ($config["ref_property"]) {
779 779
             $service = $service->{(string)$config["ref_property"]}; 
780
-        }elseif($config["ref_method"]){
780
+        }elseif ($config["ref_method"]) {
781 781
                 $args = array();
782
-            if($config->argument){
783
-                        foreach($config->argument as $arg){
782
+            if ($config->argument) {
783
+                        foreach ($config->argument as $arg) {
784 784
                             $args[] = $this->buildArg($arg);
785 785
                         }
786 786
                 }
787 787
             $service = call_user_func_array(array($service, (string)$config["ref_method"]), $args);
788 788
         }       
789
-        if(!is_object($service)){
789
+        if (!is_object($service)) {
790 790
             throw new \RuntimeException('Could not create Service.'); 
791 791
         }
792 792
         $service = $this->modifyService($service, $config);
793 793
         $id = trim((string)$config['id']);
794
-        if($service && $id != ''){
794
+        if ($service && $id != '') {
795 795
             $this->services[$id] = $service;    
796 796
         }
797 797
         return $service;
@@ -807,21 +807,21 @@  discard block
 block discarded – undo
807 807
      * @param string $defaultClass class to create instance for if none is set in config 
808 808
      * @return object build and modified srvice instance
809 809
      */    
810
-    protected static function doBuild($config, $arguments, $defaultClass = false){
810
+    protected static function doBuild($config, $arguments, $defaultClass = false) {
811 811
         $cls = $config["class"] ? trim((string)$config["class"]) : (string)$defaultClass;
812
-        if($cls != ''){
812
+        if ($cls != '') {
813 813
             try {
814 814
                 $constructor = (string)$config["constructor"];
815
-        if($constructor != ''){
815
+        if ($constructor != '') {
816 816
             $service = call_user_func_array(array($cls, $constructor), $arguments); 
817
-        }else{
817
+        }else {
818 818
             $service = self::build($cls, $arguments); 
819 819
         }        
820
-            }catch(\Exception $e){
820
+            } catch (\Exception $e) {
821 821
                 throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage());
822 822
             }           
823 823
         }
824
-        if(is_object($service)){
824
+        if (is_object($service)) {
825 825
             return $service;
826 826
         }       
827 827
         throw new \RuntimeException('Could not create Service "'.$cls.'". Class does not exist.');           
@@ -837,13 +837,13 @@  discard block
 block discarded – undo
837 837
      * @param array $arguments arguments for the constructor 
838 838
      * @return object build and modified srvice instance
839 839
      */     
840
-    protected static function build($className, $arguments){
840
+    protected static function build($className, $arguments) {
841 841
         return GenericBuilder::getInstance($className)->build($arguments);
842 842
     }
843 843
 
844
-    protected static function hasPublicProperty($service, $type, $name){
844
+    protected static function hasPublicProperty($service, $type, $name) {
845 845
         $reflection = GenericBuilder::getInstance(get_class($service))->getReflectionClass();
846
-        if($reflection->{'has'.$type}($name) && $reflection->{'get'.$type}($name)->isPublic()){
846
+        if ($reflection->{'has'.$type}($name) && $reflection->{'get'.$type}($name)->isPublic()) {
847 847
                 return true;
848 848
         }
849 849
         return false;
Please login to merge, or discard this patch.
Braces   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public static function createFromFile($file){
102 102
         if(file_exists($file)){
103 103
             return self::createFromString(file_get_contents($file));
104
-        }else{
104
+        } else{
105 105
             throw new \RuntimeException('Cannot open file  "'.$file.'".');
106 106
         }
107 107
     }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
                     $setter = self::getSetter($property);               
394 394
                     if($setter &&  self::hasPublicProperty($service, 'Method', $setter)){
395 395
                         $service->{$setter}($arg);  
396
-                    }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){
396
+                    } elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){
397 397
                         $service->$setter = $arg;
398 398
                     }                   
399 399
                 }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
         $ref = trim((string)$config['ref']);
627 627
         if($ref != ''){
628 628
             $service = $this->getService($ref); 
629
-        }else{
629
+        } else{
630 630
             $service = $this->createService($config);
631 631
         }
632 632
         return $service;
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
     protected static function getSetter($config){
647 647
         if($config['setter']){
648 648
             $setter = (string)$config['setter'];
649
-        }elseif($config['name']){
649
+        } elseif($config['name']){
650 650
             $setter = 'set'.ucfirst((string)$config['name']);   
651 651
         }
652 652
         return $setter;     
@@ -662,26 +662,26 @@  discard block
 block discarded – undo
662 662
     protected function buildArg($config){ 
663 663
         if(trim((string)$config['value']) != ''){
664 664
             $arg = (string)$config['value'];
665
-        }elseif($config->getName() == 'value'){
665
+        } elseif($config->getName() == 'value'){
666 666
             $arg = (string)$config;
667
-        }elseif($config->getName() == 'list'){
667
+        } elseif($config->getName() == 'list'){
668 668
             $arg = array();
669 669
             foreach($config->children() as $entry){ 
670 670
                 if($entry->getName() == 'value'){
671 671
                     if($entry['key']){
672 672
                         $arg[(string)$entry['key']] = (string)$entry;   
673
-                    }else{
673
+                    } else{
674 674
                         $arg[] = (string)$entry;
675 675
                     }
676
-                }elseif($entry->getName() == 'service'){
676
+                } elseif($entry->getName() == 'service'){
677 677
                     $arg[] = $this->provideService($entry);
678 678
                 }
679 679
             }
680
-        }elseif($config->getName() == 'service'){
680
+        } elseif($config->getName() == 'service'){
681 681
             $arg = $this->provideService($config);
682
-        }elseif($config->list){
682
+        } elseif($config->list){
683 683
             $arg = $this->buildArg($config->list);
684
-        }elseif($config->service){
684
+        } elseif($config->service){
685 685
             $arg = $this->buildArg($config->service);
686 686
         } 
687 687
         return $arg; 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
         $channel =  $this->services[trim((string)$channelName)];
750 750
         if($channel instanceof \PEIP\INF\Channel\Channel){
751 751
             return $channel;    
752
-        }else{
752
+        } else{
753 753
             return NULL;
754 754
         }       
755 755
     }
@@ -770,14 +770,14 @@  discard block
 block discarded – undo
770 770
     public function buildAndModify($config, $arguments, $defaultClass = false){
771 771
         if("" != (string)$config["class"]  || $defaultClass){
772 772
              $service = ServiceFactory::doBuild($config, $arguments, $defaultClass);
773
-        }elseif($config["ref"]){
773
+        } elseif($config["ref"]){
774 774
             $service = $this->getService((string)$config['ref']);
775
-        }else{
775
+        } else{
776 776
             throw new \RuntimeException('Could not create Service. no class or reference given.');
777 777
         }
778 778
         if($config["ref_property"]){
779 779
             $service = $service->{(string)$config["ref_property"]}; 
780
-        }elseif($config["ref_method"]){
780
+        } elseif($config["ref_method"]){
781 781
                 $args = array();
782 782
             if($config->argument){
783 783
                         foreach($config->argument as $arg){
@@ -814,10 +814,10 @@  discard block
 block discarded – undo
814 814
                 $constructor = (string)$config["constructor"];
815 815
         if($constructor != ''){
816 816
             $service = call_user_func_array(array($cls, $constructor), $arguments); 
817
-        }else{
817
+        } else{
818 818
             $service = self::build($cls, $arguments); 
819 819
         }        
820
-            }catch(\Exception $e){
820
+            } catch(\Exception $e){
821 821
                 throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage());
822 822
             }           
823 823
         }
Please login to merge, or discard this patch.
src/Dispatcher/ClassDispatcher.php 4 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,6 @@
 block discarded – undo
71 71
      * notifies all listeners on a event on a subject
72 72
      *
73 73
      * @access public
74
-     * @param string $name name of the event
75 74
      * @param mixed $subject the subject
76 75
      * @return
77 76
      */
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
      * @param Callable|PEIP\INF\Handler\Handler $listener listener to connect
19 19
      * @return
20 20
      */
21
-    public function connect($name, $listener){
21
+    public function connect($name, $listener) {
22 22
         $name = is_object($name) ? get_class($name) : (string)$name;
23
-        if(Test::assertClassOrInterfaceExists($name)){
23
+        if (Test::assertClassOrInterfaceExists($name)) {
24 24
             parent::connect($name, $listener);
25
-        }else{
25
+        }else {
26 26
             throw new \InvalidArgumentException($name." is not an Class nor Interface");
27 27
         }
28 28
     }
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
      * @param mixed $subject the subject
36 36
      * @return
37 37
      */
38
-    public function notify($name, $subject){
38
+    public function notify($name, $subject) {
39 39
         $res = false;
40
-        foreach(Reflection::getImplementedClassesAndInterfaces($name) as $cls){
41
-            if(parent::hasListeners($cls)){
40
+        foreach (Reflection::getImplementedClassesAndInterfaces($name) as $cls) {
41
+            if (parent::hasListeners($cls)) {
42 42
                 self::doNotify($this->getListeners($cls), $subject);
43 43
                 $res = true;
44 44
             }
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
      * @param mixed $subject the subject
57 57
      * @return \PEIP\INF\Handler\Handler listener which returned a boolean true value
58 58
      */
59
-    public function notifyUntil($name, $subject){
59
+    public function notifyUntil($name, $subject) {
60 60
         $res = NULL;
61
-        foreach(Reflection::getImplementedClassesAndInterfaces($name) as $cls){
62
-            if(!$res && parent::hasListeners($cls)){
61
+        foreach (Reflection::getImplementedClassesAndInterfaces($name) as $cls) {
62
+            if (!$res && parent::hasListeners($cls)) {
63 63
                 $res = self::doNotifyUntil($this->getListeners($cls), $subject);
64 64
             }
65 65
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param mixed $subject the subject
76 76
      * @return
77 77
      */
78
-    public function notifyOfInstance($subject){
78
+    public function notifyOfInstance($subject) {
79 79
 
80 80
         return $this->notify(get_class($subject), $subject);
81 81
     }
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      * @param string $name name of the event
87 87
      * @return boolean wether any listener is registered for event-name
88 88
      */
89
-    public function hasListeners($name){
90
-        foreach(Reflection::getImplementedClassesAndInterfaces($name) as $cls){
91
-            if(parent::hasListeners($cls)){
89
+    public function hasListeners($name) {
90
+        foreach (Reflection::getImplementedClassesAndInterfaces($name) as $cls) {
91
+            if (parent::hasListeners($cls)) {
92 92
                 return true;
93 93
             }
94 94
         }
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Dispatcher/ClassEventDispatcher.php 5 patches
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@
 block discarded – undo
11 11
  *
12 12
  * @author timo
13 13
  */
14
-use PEIP\Util\Reflection;
15
-use PEIP\Util\ReflectionPool;
14
+use PEIP\Util\Reflection;
16 15
 use PEIP\Event\EventBuilder;
17 16
 
18 17
 class ClassEventDispatcher extends \PEIP\Dispatcher\ObjectEventDispatcher {
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
                         Reflection_Pool::getInstance(
68 68
                             $object->getContent()
69 69
                         )
70
-                     ),
71
-                     $object
72
-                 );
70
+                        ),
71
+                        $object
72
+                    );
73 73
             }else{
74 74
                 throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
75 75
             }
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
         }
79 79
     }       //put your code here
80 80
 
81
-     /**
82
-     * Creates an event-object with given object as content/subject and notifies
83
-     * all registers listeners of the event.
84
-     *
85
-     * @access public
86
-     * @param string $name name of the event
87
-     * @param object $object the subject of the event
88
-     * @param array $headers headers of the event-object as key/value pairs
89
-     * @param string $eventClass event-class to create instances from
90
-     * @return
91
-     * @see EventBuilder
92
-     */
81
+        /**
82
+         * Creates an event-object with given object as content/subject and notifies
83
+         * all registers listeners of the event.
84
+         *
85
+         * @access public
86
+         * @param string $name name of the event
87
+         * @param object $object the subject of the event
88
+         * @param array $headers headers of the event-object as key/value pairs
89
+         * @param string $eventClass event-class to create instances from
90
+         * @return
91
+         * @see EventBuilder
92
+         */
93 93
     public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){
94 94
         if(!$this->hasListeners($name, ($object))){
95 95
             return false;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
      * @param Callable|PEIP\INF\Handler\Handler $listener event-handler
28 28
      * @return boolean
29 29
      */
30
-    public function connect($name, $object, $listener){ 
30
+    public function connect($name, $object, $listener) { 
31 31
         $class = is_object($object) ? get_class($object) : (string)$object;
32
-        foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){
32
+        foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) {
33 33
             $reflection = Reflection_Pool::getInstance($class);
34 34
             parent::connect($name, $reflection, $listener);
35 35
         }
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
         return true;
38 38
     }
39 39
 
40
-    public function disconnect($name, $object, $listener){
40
+    public function disconnect($name, $object, $listener) {
41 41
         $class = is_object($object) ? get_class($object) : (string)$object;
42 42
         $res = true;
43
-        foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){
43
+        foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) {
44 44
             $reflection = Reflection_Pool::getInstance($class);
45 45
             $r = parent::disconnect($name, $reflection, $listener);
46
-            if(!$r){
46
+            if (!$r) {
47 47
                 $res = false;
48 48
             }
49 49
         }
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
      * @param \PEIP\INF\Event\Event $object an event object
59 59
      * @return boolean
60 60
      */
61
-    public function notify($name, $object){ 
62
-        if($object instanceof \PEIP\INF\Event\Event){
63
-            if(is_object($object->getContent())){
61
+    public function notify($name, $object) { 
62
+        if ($object instanceof \PEIP\INF\Event\Event) {
63
+            if (is_object($object->getContent())) {
64 64
                 return self::doNotify(
65 65
                     $this->getListeners(
66 66
                         $name,
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
                      ),
71 71
                      $object
72 72
                  );
73
-            }else{
73
+            }else {
74 74
                 throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
75 75
             }
76
-        }else{
76
+        }else {
77 77
             throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event');
78 78
         }
79 79
     }       //put your code here
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
      * @return
91 91
      * @see EventBuilder
92 92
      */
93
-    public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){
94
-        if(!$this->hasListeners($name, ($object))){
93
+    public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) {
94
+        if (!$this->hasListeners($name, ($object))) {
95 95
             return false;
96 96
         }
97 97
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @param object $object object to check for listeners
115 115
      * @return boolean
116 116
      */
117
-    public function hasListeners($name, $object){
117
+    public function hasListeners($name, $object) {
118 118
         return parent::hasListeners(
119 119
             $name,
120 120
             Reflection_Pool::getInstance($object)
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,10 +70,10 @@
 block discarded – undo
70 70
                      ),
71 71
                      $object
72 72
                  );
73
-            }else{
73
+            } else{
74 74
                 throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
75 75
             }
76
-        }else{
76
+        } else{
77 77
             throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event');
78 78
         }
79 79
     }       //put your code here
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @access public
24 24
      * @param string $name name of the event
25 25
      * @param \PEIP\INF\Event\Event $object an event object
26
-     * @return boolean
26
+     * @return boolean|null
27 27
      */
28 28
     public function notify($name, $object){ 
29 29
         if($object instanceof \PEIP\INF\Event\Event){
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param array $headers headers of the event-object as key/value pairs
54 54
      * @param string $eventClass event-class to create instances from
55 55
      * @return
56
-     * @see EventBuilder
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))){
Please login to merge, or discard this patch.
src/Dispatcher/Dispatcher.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,6 @@
 block discarded – undo
65 65
      * Disconnects all listeners.
66 66
      * 
67 67
      * @access public
68
-     * @param Callable|PEIP\INF\Handler\Handler $listener
69 68
      * @return void
70 69
      */
71 70
     public function disconnectAll(){
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param Callable|PEIP\INF\Handler\Handler  $listener
41 41
      * @return void
42 42
      */
43
-    public function connect($listener){
43
+    public function connect($listener) {
44 44
         Test::ensureHandler($listener);
45 45
         $this->listeners[] = $listener;
46 46
     }
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
      * @param Callable|PEIP\INF\Handler\Handler $listener
53 53
      * @return void
54 54
      */
55
-    public function disconnect($listener){
55
+    public function disconnect($listener) {
56 56
         Test::ensureHandler($listener);
57
-        foreach ($this->listeners as $i => $callable){
58
-            if ($listener === $callable){
57
+        foreach ($this->listeners as $i => $callable) {
58
+            if ($listener === $callable) {
59 59
                 unset($this->listeners[$i]);
60 60
             }
61 61
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param Callable|PEIP\INF\Handler\Handler $listener
69 69
      * @return void
70 70
      */
71
-    public function disconnectAll(){
71
+    public function disconnectAll() {
72 72
         $this->listeners = array();
73 73
     }
74 74
 
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
      * @access public
79 79
      * @return boolean wether any listeners are registered
80 80
      */
81
-    public function hasListeners(){
82
-        return (boolean) count($this->listeners);
81
+    public function hasListeners() {
82
+        return (boolean)count($this->listeners);
83 83
     }
84 84
     
85 85
     /**
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      * @param mixed $subject the subject
90 90
      * @return void
91 91
      */
92
-    public function notify($subject){
92
+    public function notify($subject) {
93 93
         $res = NULL;
94
-        if($this->hasListeners()){
94
+        if ($this->hasListeners()) {
95 95
             $res = self::doNotify($this->getListeners(), $subject); 
96 96
         }   
97 97
         return $res;      
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
      * @param mixed $subject the subject 
105 105
      * @return \PEIP\INF\Handler\Handler the listener which returned a boolean true value
106 106
      */
107
-    public function notifyUntil($subject){
108
-        if($this->hasListeners()){
107
+    public function notifyUntil($subject) {
108
+        if ($this->hasListeners()) {
109 109
             $res = self::doNotifyUntil($this->getListeners(), $subject);    
110 110
         }
111 111
         return $res;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      * @access public
118 118
      * @return array the listeners
119 119
      */
120
-    public function getListeners(){
120
+    public function getListeners() {
121 121
         return $this->listeners;
122 122
     }
123 123
 
Please login to merge, or discard this patch.