Completed
Push — v1.ns ( 31020d...499c60 )
by Timo
04:35 queued 01:07
created
src/Pipe/EventPipe.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     protected 
30 30
         $eventName; 
31 31
        
32
-    public function connectChannel(\PEIP\INF\Channel\Channel $inputChannel){
32
+    public function connectChannel(\PEIP\INF\Channel\Channel $inputChannel) {
33 33
         $this->inputChannel = $inputChannel;
34 34
         
35 35
     }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param \PEIP\INF\Channel\Channel $inputChannel the input-channel to listen for events. 
45 45
      * @return 
46 46
      */
47
-    public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel){        
47
+    public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel) {        
48 48
         $this->connectChannel($inputChannel);            
49 49
     }     
50 50
   
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
      * @access protected
61 61
      * @param \PEIP\INF\Message\Message $message the message to reply with
62 62
      */
63
-    protected function doReply(\PEIP\INF\Message\Message $message){
63
+    protected function doReply(\PEIP\INF\Message\Message $message) {
64 64
         $headerMessage = $message->getHeader('MESSAGE');
65
-        if($headerMessage instanceof \PEIP\INF\Message\Message){
65
+        if ($headerMessage instanceof \PEIP\INF\Message\Message) {
66 66
             return $this->replyMessage($headerMessage);
67 67
         }
68 68
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param \PEIP\INF\Event\Connectable $connectable the connectable to listen to
76 76
      * @return 
77 77
      */
78
-    public function listen(\PEIP\INF\Event\Connectable $connectable){
78
+    public function listen(\PEIP\INF\Event\Connectable $connectable) {
79 79
         return $this->doListen($this->eventName, $connectable);     
80 80
     }
81 81
        
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @param \PEIP\INF\Event\Connectable $connectable the connectable to unlisten  
88 88
      * @return 
89 89
      */
90
-    public function unlisten(\PEIP\INF\Event\Connectable $connectable){
90
+    public function unlisten(\PEIP\INF\Event\Connectable $connectable) {
91 91
         return $this->doUnlisten($this->eventName, $connectable);       
92 92
     }
93 93
      
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @access public
98 98
      * @return array array of \PEIP\INF\Event\Connectable instances
99 99
      */
100
-    public function getConnected(){
100
+    public function getConnected() {
101 101
         return $this->doGetConnected();
102 102
     }
103 103
        
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param \PEIP\INF\Channel\Channel $channel \PEIP\INF\Channel\Channel instance to disconnect from
109 109
      * @return 
110 110
      */
111
-    public function disconnectChannel(\PEIP\INF\Channel\Channel $channel){
111
+    public function disconnectChannel(\PEIP\INF\Channel\Channel $channel) {
112 112
         $this->disconnectInputChannel();        
113 113
         $this->inputChannel = $channel;         
114 114
         $this->connectInputChannel();       
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
      * @access protected
122 122
      * @return 
123 123
      */
124
-    protected function connectInputChannel(){
125
-        if($this->inputChannel && $this->eventName){
124
+    protected function connectInputChannel() {
125
+        if ($this->inputChannel && $this->eventName) {
126 126
             $this->inputChannel->connect($this->eventName, $this);
127 127
         }   
128 128
     }
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
      * @access protected
135 135
      * @return 
136 136
      */
137
-    protected function disconnectInputChannel(){
138
-        if($this->inputChannel && $this->eventName){
137
+    protected function disconnectInputChannel() {
138
+        if ($this->inputChannel && $this->eventName) {
139 139
             $this->inputChannel->disconnect($this->eventName, $this);
140 140
         }       
141 141
     }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @param $eventName 
148 148
      * @return 
149 149
      */
150
-    public function setEventName($eventName){
150
+    public function setEventName($eventName) {
151 151
         $this->disconnectInputChannel();
152 152
         $this->eventName = $eventName;
153 153
         $this->connectInputChannel();
Please login to merge, or discard this patch.
src/Pipe/SimpleEventPipe.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
      * @param $outputChannel 
34 34
      * @return 
35 35
      */
36
-    public function __construct($eventName, \PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel){
36
+    public function __construct($eventName, \PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel) {
37 37
         $this->setEventName($eventName);
38 38
         $this->setInputChannel($inputChannel);
39 39
         $this->setOutputChannel($outputChannel);        
Please login to merge, or discard this patch.
src/Pipe/FixedEventPipe.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
      * @param $inputChannel 
32 32
      * @return 
33 33
      */
34
-    public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel){        
35
-        if(isset($this->eventName)){
34
+    public function setInputChannel(\PEIP\INF\Channel\Channel $inputChannel) {        
35
+        if (isset($this->eventName)) {
36 36
             $this->connectChannel($inputChannel);   
37
-        }else{
37
+        }else {
38 38
             $this->inputChannel = $inputChannel;    
39 39
         }               
40 40
     }       
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
      * @param $eventName 
46 46
      * @return 
47 47
      */
48
-    public function setEventName($eventName){
49
-        if(!isset($this->eventName)){
48
+    public function setEventName($eventName) {
49
+        if (!isset($this->eventName)) {
50 50
             $this->eventName = $eventName;
51
-            if($this->inputChannel){
51
+            if ($this->inputChannel) {
52 52
                 $this->inputChannel->connect($this->eventName, $this);
53 53
             }   
54 54
         }
Please login to merge, or discard this patch.
src/Pipe/CommandPipe.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      * @param $content 
35 35
      * @return 
36 36
      */
37
-    protected function replyMessage($content){
37
+    protected function replyMessage($content) {
38 38
         $message = $this->ensureMessage($content);      
39 39
         $this->getOutputChannel()->command($message);       
40 40
     }
Please login to merge, or discard this patch.
src/Gateway/SimpleMessagingGateway.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
      * @param \PEIP\INF\Channel\PollableChannel $replyChannel The default channel to receive requests from the gateway
44 44
      * @param array $defaultHeaders The default headers to apply to request messages 
45 45
      */
46
-    public function __construct(\PEIP\INF\Channel\Channel $requestChannel, \PEIP\INF\Channel\Channel $replyChannel = NULL, array $defaultHeaders = array()){
46
+    public function __construct(\PEIP\INF\Channel\Channel $requestChannel, \PEIP\INF\Channel\Channel $replyChannel = NULL, array $defaultHeaders = array()) {
47 47
         $this->setRequestChannel($requestChannel);
48
-        if($replyChannel){
48
+        if ($replyChannel) {
49 49
             $this->setReplyChannel($replyChannel);
50 50
         }     
51 51
         $this->defaultHeaders = $defaultHeaders;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param \PEIP\INF\Channel\Channel $replyChannel The default channel to receive requests from the gateway
60 60
      * @return 
61 61
      */
62
-    public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel){
62
+    public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel) {
63 63
         $this->requestChannel = $requestChannel;
64 64
     }
65 65
   
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
      * @param \PEIP\INF\Channel\PollableChannel $replyChannel The default channel to receive requests from the gateway
71 71
      * @return 
72 72
      */
73
-    public function setReplyChannel(\PEIP\INF\Channel\Channel $replyChannel){
74
-        if(!($replyChannel instanceof \PEIP\INF\Channel\PollableChannel)){
73
+    public function setReplyChannel(\PEIP\INF\Channel\Channel $replyChannel) {
74
+        if (!($replyChannel instanceof \PEIP\INF\Channel\PollableChannel)) {
75 75
             throw new \InvalidArgumentException('reply channel must be instance of \PEIP\INF\Channel\PollableChannel.');
76 76
         }       
77 77
         $this->replyChannel = $replyChannel;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param mixed $content the content/payload for the message to send 
85 85
      * @return 
86 86
      */
87
-    public function send($content){
87
+    public function send($content) {
88 88
         return $this->requestChannel->send($this->buildMessage($content));
89 89
     }
90 90
    
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
      * @access public
95 95
      * @return mixed content/payload of the received message
96 96
      */
97
-    public function receive(){
98
-        if(!isset($this->replyChannel)){
97
+    public function receive() {
98
+        if (!isset($this->replyChannel)) {
99 99
             throw new \LogicException('No replyChannel set.');
100 100
         }       
101 101
         $message = $this->replyChannel->receive();
102
-        if($message){
102
+        if ($message) {
103 103
             return $message->getContent();
104 104
         }
105 105
         return NULL;
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
      * @param mixed $content the content/payload for the message to send 
113 113
      * @return mixed content/payload of the received message
114 114
      */
115
-    public function sendAndReceive($content){
115
+    public function sendAndReceive($content) {
116 116
         $this->send($content);
117 117
         try {
118 118
             $res = $this->receive();
119 119
         }
120
-        catch(\Exception $e){
120
+        catch (\Exception $e) {
121 121
             return NULL;
122 122
         }
123 123
         return $res;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @param mixed $content the content/payload for the message to send 
131 131
      * @return \PEIP\INF\Message\Message the built message
132 132
      */
133
-    protected function buildMessage($content){
133
+    protected function buildMessage($content) {
134 134
         return $this->getMessageBuilder()->setContent($content)->build();   
135 135
     }   
136 136
       
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      * @access protected
141 141
      * @return MessageBuilder message builder instance for the registerd message class
142 142
      */
143
-    protected function getMessageBuilder(){
143
+    protected function getMessageBuilder() {
144 144
         return isset($this->messageBuilder) && ($this->messageBuilder->getMessageClass() == $this->getMessageClass())
145 145
             ? $this->messageBuilder
146 146
             : $this->messageBuilder = MessageBuilder::getInstance($this->messageClass)->setHeaders($this->defaultHeaders);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      * @param   string $messageClass message class to create instances from
154 154
      * @return 
155 155
      */
156
-    public function setMessageClass($messageClass){
156
+    public function setMessageClass($messageClass) {
157 157
         $this->messageClass = $messageClass;
158 158
     }
159 159
     
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      * @access public
164 164
      * @return string message class to create instances from
165 165
      */
166
-    public function getMessageClass(){
166
+    public function getMessageClass() {
167 167
         return $this->messageClass;
168 168
     }   
169 169
 
Please login to merge, or discard this patch.
src/Util/Reflection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
      * @return array array with interface/class info for the class
31 31
      */
32 32
 
33
-    public static function getImplementedClassesAndInterfaces($class, $store = true){
33
+    public static function getImplementedClassesAndInterfaces($class, $store = true) {
34 34
         $class = is_object($class) ? get_class($class) : (string)$class;
35
-        if(isset(self::$classInfo[$class])){
35
+        if (isset(self::$classInfo[$class])) {
36 36
             return self::$classInfo[$class];
37 37
         }
38 38
         $cls = ReflectionPool::getInstance($class);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $classInfo = (array)$cls->getInterfaceNames();
41 41
         $classInfo[] = $cls->getName();
42 42
         // get names of parent-classes
43
-        while($cls = $cls->getParentClass()){
43
+        while ($cls = $cls->getParentClass()) {
44 44
             $classInfo[] = $cls->getName();
45 45
         }
46 46
         
Please login to merge, or discard this patch.
src/Util/Test.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 class Test {
16 16
 
17 17
 
18
-    public static function assertClassHasConstructor($className){
19
-        return (boolean) ReflectionPool::getInstance($className)->getConstructor();
18
+    public static function assertClassHasConstructor($className) {
19
+        return (boolean)ReflectionPool::getInstance($className)->getConstructor();
20 20
     }
21 21
 
22
-    public static function assertRequiredConstructorParameters($className, $parameters){
22
+    public static function assertRequiredConstructorParameters($className, $parameters) {
23 23
             return (boolean)
24 24
                 !self::assertClassHasConstructor($className) ||
25 25
                 count($parameters) >= ReflectionPool::getInstance($className)
@@ -27,55 +27,55 @@  discard block
 block discarded – undo
27 27
                     ->getNumberOfRequiredParameters();
28 28
     }
29 29
 
30
-    public static function assertInstanceOf($className, $object){
31
-        return (boolean) ReflectionPool::getInstance($className)
30
+    public static function assertInstanceOf($className, $object) {
31
+        return (boolean)ReflectionPool::getInstance($className)
32 32
             ->isInstance($object);
33 33
     }
34 34
 
35
-    public static function assertClassOrInterfaceExists($className){
36
-        return (boolean) class_exists($className) || interface_exists($className);
35
+    public static function assertClassOrInterfaceExists($className) {
36
+        return (boolean)class_exists($className) || interface_exists($className);
37 37
     }
38 38
 
39
-    public static function assertImplements($className, $interfaceName){
39
+    public static function assertImplements($className, $interfaceName) {
40 40
         $className = is_object($className) ? get_class($className) : $className;
41 41
         $res = false;
42 42
         try { 
43 43
             class_exists($className);
44
-            $res =  ReflectionPool::getInstance($className)
44
+            $res = ReflectionPool::getInstance($className)
45 45
                 ->implementsInterface($interfaceName);            
46
-        }  catch (\Exception $e){
46
+        } catch (\Exception $e) {
47 47
             $res = false; 
48 48
         }
49
-        return $res;;
49
+        return $res; ;
50 50
     }
51 51
 
52
-    public static function assertMessage($message){
52
+    public static function assertMessage($message) {
53 53
         return self::assertImplements($message, '\PEIP\INF\Message\Message');
54 54
     }
55 55
 
56
-    public static function assertEvent($event){
56
+    public static function assertEvent($event) {
57 57
         return self::assertImplements($event, '\PEIP\INF\Event\Event');
58 58
     }
59 59
 
60
-    public static function assertEventSubject($event){
60
+    public static function assertEventSubject($event) {
61 61
         return self::assertImplements($event, '\PEIP\INF\Event\Event')
62 62
             && $event->getSubject();
63 63
     }
64 64
 
65
-    public static function assertEventObjectSubject($event){
65
+    public static function assertEventObjectSubject($event) {
66 66
         return self::assertEventSubject($event)
67 67
             && is_object($event->getSubject());
68 68
     }
69
-    public static function assertArrayAccess($var){
70
-        return (boolean) is_array($var) || $var instanceof \ArrayAccess;
69
+    public static function assertArrayAccess($var) {
70
+        return (boolean)is_array($var) || $var instanceof \ArrayAccess;
71 71
     }
72 72
 
73
-    public static function assertHandler($var){
74
-        return (boolean) is_callable($var) || $var instanceof \PEIP\INF\Handler\Handler;
73
+    public static function assertHandler($var) {
74
+        return (boolean)is_callable($var) || $var instanceof \PEIP\INF\Handler\Handler;
75 75
     }
76 76
 
77
-    public static function castType($var, $type){
78
-        switch($type){
77
+    public static function castType($var, $type) {
78
+        switch ($type) {
79 79
             case 'string':
80 80
                 $var = (string)$var;
81 81
                 break;
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
         return $var;
100 100
     }
101 101
 
102
-    public static function ensureArrayAccess($var){
103
-        if(!Test::assertArrayAccess($var)){
102
+    public static function ensureArrayAccess($var) {
103
+        if (!Test::assertArrayAccess($var)) {
104 104
             throw new \InvalidArgumentException(
105 105
                 'Value is not an array nor an instance of ArrayAccess'
106 106
             );
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
     }
110 110
 
111 111
 
112
-    public static function ensureHandler($var){
113
-        if(!Test::assertHandler($var)){
112
+    public static function ensureHandler($var) {
113
+        if (!Test::assertHandler($var)) {
114 114
             throw new \InvalidArgumentException(
115 115
                 'Value is not an callable nor an instance of \PEIP\INF\Handler\Handler'
116 116
             );
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
         return $var;
119 119
     }
120 120
 
121
-    public static function ensureImplements($className, $interfaceName){
122
-        if(!Test::assertImplements($className, $interfaceName)){
121
+    public static function ensureImplements($className, $interfaceName) {
122
+        if (!Test::assertImplements($className, $interfaceName)) {
123 123
             throw new \InvalidArgumentException(
124 124
                 'Class "'.$className.'" is not an instanceof "'.$interfaceName.'"'
125 125
             );
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         return $className;
128 128
     }
129 129
 
130
-    public static function assertMethod($className, $methodname){
130
+    public static function assertMethod($className, $methodname) {
131 131
         return ReflectionPool::getInstance($className)->hasMethod($methodname);
132 132
     }
133 133
 
Please login to merge, or discard this patch.
src/Util/ReflectionPool.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@
 block discarded – undo
22 22
      * @param $argument
23 23
      * @return ReflectionClass
24 24
      */
25
-    public  static function getInstance($argument){
25
+    public  static function getInstance($argument) {
26 26
 
27 27
         $className = is_object($argument)
28 28
             ? get_class($argument)
29
-            : (string) $argument;
29
+            : (string)$argument;
30 30
         return isset(self::$instances[$className])
31 31
             ? self::$instances[$className]
32 32
             : self::$instances[$className] = new \ReflectionClass($className);
Please login to merge, or discard this patch.
src/Event/EventBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param string $eventClass the event-class the builder shall create instances for 
38 38
      * @param array $defaultHeaders default headers for the created events 
39 39
      */
40
-    public function __construct($eventClass = '\PEIP\Event\Event', array $defaultHeaders = array()){
40
+    public function __construct($eventClass = '\PEIP\Event\Event', array $defaultHeaders = array()) {
41 41
         $this->eventClass = $eventClass;
42 42
         $this->defaultParameters = $defaultHeaders;
43 43
     }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param string $eventClass the event-class the builder shall create instances for 
50 50
      * @return EventBuilder the instance of EventBuilder for the given event-class 
51 51
      */    
52
-    public static function getInstance($eventClass = '\PEIP\Event\Event'){ 
52
+    public static function getInstance($eventClass = '\PEIP\Event\Event') { 
53 53
 
54 54
         return isset(self::$instances[$eventClass]) 
55 55
             ? self::$instances[$eventClass] 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @param array $headers the headers for the event 
68 68
      * @return object event instance
69 69
      */
70
-    public function build($subject, $name, array $headers = array()){
70
+    public function build($subject, $name, array $headers = array()) {
71 71
 
72 72
         return new $this->eventClass(
73 73
             $subject,
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param array $parameters the headers for the event
87 87
      * @return 
88 88
      */
89
-    public function buildAndDispatch(ObjectEventDispatcher $dispatcher, $subject, $name, array $headers = array()){
89
+    public function buildAndDispatch(ObjectEventDispatcher $dispatcher, $subject, $name, array $headers = array()) {
90 90
   
91 91
         return $dispatcher->notify(
92 92
             $name,
Please login to merge, or discard this patch.