Completed
Push — v1.ns ( bf5bec...7eab28 )
by Timo
09:21 queued 04:44
created
src/Dispatcher/ClassEventDispatcher.php 5 patches
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.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 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;
15
+use PEIP\Util\ReflectionPool;
16 16
 use PEIP\Event\EventBuilder;
17 17
 
18 18
 class ClassEventDispatcher extends \PEIP\Dispatcher\ObjectEventDispatcher {
Please login to merge, or discard this patch.
src/Dispatcher/IteratingDispatcher.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
      * @param mixed array|ArrayAccess array with values to iterate over
42 42
      * @return 
43 43
      */
44
-    public function __construct($array = array()){
44
+    public function __construct($array = array()) {
45 45
         $this->init($array);
46 46
     }
47 47
 
48
-    protected function init($array = array()){
48
+    protected function init($array = array()) {
49 49
         $array = Test::assertArrayAccess($array)
50 50
             ? $array
51 51
             : array();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param mixed $listener the listener to register
60 60
      * @return 
61 61
      */
62
-    public function connect($listener){
62
+    public function connect($listener) {
63 63
         $this->listeners[] = $listener;
64 64
     }
65 65
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      * @param mixed $listener the listener to unregister
71 71
      * @return 
72 72
      */
73
-    public function disconnect($listener){
74
-        foreach ($this->listeners as $i => $callable){
75
-            if ($listener === $callable){
73
+    public function disconnect($listener) {
74
+        foreach ($this->listeners as $i => $callable) {
75
+            if ($listener === $callable) {
76 76
                 unset($this->listeners[$i]);
77 77
             }
78 78
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @access public
86 86
      * @return
87 87
      */
88
-    public function disconnectAll(){
88
+    public function disconnectAll() {
89 89
         $this->init();
90 90
     }
91 91
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
      * @access public
96 96
      * @return boolean wether any listener is registered
97 97
      */
98
-    public function hasListeners(){
99
-        return (boolean) $this->listeners->count();
98
+    public function hasListeners() {
99
+        return (boolean)$this->listeners->count();
100 100
     }
101 101
 
102 102
     /**
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
      * @param mixed $subject the subject to notify about 
109 109
      * @return 
110 110
      */
111
-    public function notify($subject){
111
+    public function notify($subject) {
112 112
         $res = NULL;
113
-        if($this->hasListeners()){
114
-            if(!$this->listeners->valid()){
113
+        if ($this->hasListeners()) {
114
+            if (!$this->listeners->valid()) {
115 115
                 $this->listeners->rewind();
116 116
             }
117 117
             $res = self::doNotifyOne($this->listeners->current(), $subject);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @access public
127 127
      * @return array registered listeners 
128 128
      */
129
-    public function getListeners(){
129
+    public function getListeners() {
130 130
         return $this->listeners->getArrayCopy();
131 131
     }
132 132
     
Please login to merge, or discard this patch.
src/Base/ObjectStorage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,4 +20,4 @@
 block discarded – undo
20 20
 
21 21
 
22 22
 class ObjectStorage
23
-    extends \SplObjectStorage{}
23
+    extends \SplObjectStorage {}
Please login to merge, or discard this patch.
src/Base/DynamicAdapter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param $subject 
37 37
      * @return 
38 38
      */
39
-    public function __construct(\ArrayAccess $methodMap, $subject){
39
+    public function __construct(\ArrayAccess $methodMap, $subject) {
40 40
         $this->methodMap = $methodMap;
41 41
         $this->subject = $subject;      
42 42
     }
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
      * @param $arguments 
49 49
      * @return 
50 50
      */
51
-    public function __call($method, array $arguments){
52
-        if(array_key_exists($method, $this->methodMap)){
51
+    public function __call($method, array $arguments) {
52
+        if (array_key_exists($method, $this->methodMap)) {
53 53
             return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments);
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
src/Base/VisitableArray.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 class VisitableArray 
26 26
     extends \RecursiveArrayIterator 
27
-    implements \PEIP\INF\Base\Visitable{
27
+    implements \PEIP\INF\Base\Visitable {
28 28
 
29 29
 
30 30
     
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
      * @param $visitor 
34 34
      * @return 
35 35
      */
36
-    public function acceptVisitor(\PEIP\INF\Base\Visitor $visitor){
37
-        if($this->hasChildren()){
38
-            foreach($this->getChildren as $child){
36
+    public function acceptVisitor(\PEIP\INF\Base\Visitor $visitor) {
37
+        if ($this->hasChildren()) {
38
+            foreach ($this->getChildren as $child) {
39 39
                 $child->acceptVisitor($visitor);
40 40
             }
41 41
         }
Please login to merge, or discard this patch.
src/Base/ReflectionClassBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      * @param string $className name of the class to return ReflectionClass for 
33 33
      * @return ReflectionClass the ReflectionClass instance for given class
34 34
      */    
35
-    protected static function getReflectionClass($className){
35
+    protected static function getReflectionClass($className) {
36 36
         return array_key_exists($className, self::$reflectionClasses) 
37 37
             ? self::$reflectionClasses[$className] 
38 38
             : (self::$reflectionClasses[$className] = new \ReflectionClass($className)); 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param string $className name of the class to return ReflectionClass for 
48 48
      * @return ReflectionClass the ReflectionClass instance for given class
49 49
      */     
50
-    public static function getInstance($className){
50
+    public static function getInstance($className) {
51 51
         return self::getReflectionClass($className);
52 52
     }
53 53
 
Please login to merge, or discard this patch.
src/Base/FlyAdapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @param $methodMap 
31 31
      * @return 
32 32
      */
33
-    public function __construct(ArrayAccess $methodMap){        
33
+    public function __construct(ArrayAccess $methodMap) {        
34 34
         $this->methodMap = $methodMap;  
35 35
     }
36 36
     
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param $subject 
41 41
      * @return 
42 42
      */
43
-    public function setSubject($subject){
43
+    public function setSubject($subject) {
44 44
         $this->subject = $subject;
45 45
         return $this;
46 46
     }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
      * @param $arguments 
53 53
      * @return 
54 54
      */
55
-    public function __call($method, $arguments){
56
-        if(array_key_exists($method, $this->methodMap)){
55
+    public function __call($method, $arguments) {
56
+        if (array_key_exists($method, $this->methodMap)) {
57 57
             return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments);
58 58
         }
59 59
     }
Please login to merge, or discard this patch.
src/Base/Sealer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param ObjectStorage $store an instane of ObjectStorage to act as the internal object-store
39 39
      * @return 
40 40
      */
41
-    public function __construct(\SplObjectStorage $store = NULL){
41
+    public function __construct(\SplObjectStorage $store = NULL) {
42 42
         $this->store = (bool)$store ? $store : new ObjectStorage;    
43 43
     }   
44 44
       
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param object $box an object to act as the 'box'  
54 54
      * @return object the 'box' for the sealed value
55 55
      */
56
-    public function seal($value, $box = false){
56
+    public function seal($value, $box = false) {
57 57
         $box = (bool)$box ? $box : new \stdClass;
58 58
         $this->store[$box] = $value;        
59 59
         return $box;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param object $box the box-object to return the value for. 
67 67
      * @return 
68 68
      */
69
-    public function unseal($box){
69
+    public function unseal($box) {
70 70
         return $this->store[$box];
71 71
     }
72 72
 }
Please login to merge, or discard this patch.
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.