Completed
Push — v1.ns ( 410f3f...ff674e )
by Timo
04:13
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   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  *
12 12
  * @author timo
13 13
  */
14
-use PEIP\Util\Reflection;
14
+use PEIP\Util\Reflection;
15 15
 use PEIP\Event\EventBuilder;
16 16
 
17 17
 class ClassEventDispatcher extends \PEIP\Dispatcher\ObjectEventDispatcher {
Please login to merge, or discard this patch.