Completed
Push — master ( 383466...f53a3b )
by Garrett
03:21
created
src/Observer.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@
 block discarded – undo
108 108
         } else {
109 109
             $autohandlers = [];
110 110
 
111
-            foreach ($methods as $method) { // slow
111
+            foreach ($methods as $method) {
112
+// slow
112 113
                 //extract the event name from the method name
113 114
                 $eventName = lcfirst(substr($method->name, 2));
114 115
 
Please login to merge, or discard this patch.
example/observers/Fancify.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@
 block discarded – undo
17 17
  */
18 18
 class Fancify extends Noair\Observer
19 19
 {
20
-    public function onCreatePost(Event $event) {
20
+    public function onCreatePost(Event $event)
21
+    {
21 22
         return str_replace('border:1px solid #EEE;',
22 23
             'border:1px solid #DADADA;background:#F1F1F1;font-family:Arial;font-size:15px;',
23 24
             $event->previousResult);
Please login to merge, or discard this patch.
example/observers/Formatter.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Formatter extends Noair\Observer
18 18
 {
19
-    public function subscribe() {
19
+    public function subscribe()
20
+    {
20 21
         // This is just here for an example of explicitly-defined handlers
21 22
         $this->handlers = [
22 23
             'formatUsername' => [[$this, 'formatUsername']],
@@ -28,24 +29,29 @@  discard block
 block discarded – undo
28 29
         return parent::subscribe();
29 30
     }
30 31
 
31
-    public function formatUsername(Event $event) {
32
+    public function formatUsername(Event $event)
33
+    {
32 34
         return $event->data;
33 35
     }
34 36
 
35
-    public function formatGroup(Event $event) {
37
+    public function formatGroup(Event $event)
38
+    {
36 39
         return $event->data;
37 40
     }
38 41
 
39
-    public function formatMessage(Event $event) {
42
+    public function formatMessage(Event $event)
43
+    {
40 44
         return nl2br($event->data);
41 45
     }
42 46
 
43
-    public function formatDate(Event $event) {
47
+    public function formatDate(Event $event)
48
+    {
44 49
         // return date('F j, Y h:i:s A', $event->data);
45 50
         return '';
46 51
     }
47 52
 
48
-    public function onCreatePost(Event $event) {
53
+    public function onCreatePost(Event $event)
54
+    {
49 55
         $result = '<div style="padding: 9px 16px;border:1px solid #EEE;margin-bottom:16px;">'
50 56
                  .'<strong>Posted by</strong> '
51 57
                  .$this->mediator->publish(new Event('formatUsername', $event->data['username'], $this))
Please login to merge, or discard this patch.
example/observers/BetterFormatter.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class BetterFormatter extends Noair\Observer
19 19
 {
20
-    public function onFormatGroup(Event $event) {
20
+    public function onFormatGroup(Event $event)
21
+    {
21 22
         $groupName = strtolower($event->data);
22 23
 
23 24
         switch ($groupName):
@@ -35,7 +36,8 @@  discard block
 block discarded – undo
35 36
         return $groupName;
36 37
     }
37 38
 
38
-    public function onFormatDate(Event $event) {
39
+    public function onFormatDate(Event $event)
40
+    {
39 41
         return date('F j, Y h:i:s A T', $event->data);
40 42
     }
41 43
 }
Please login to merge, or discard this patch.
example/observers/FancyExamplePlugin.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@
 block discarded – undo
17 17
  */
18 18
 class FancyExamplePlugin extends Noair\Observer
19 19
 {
20
-    public function onFormatMessage(Event $event) {
20
+    public function onFormatMessage(Event $event)
21
+    {
21 22
         $message = strip_tags($event->data);
22 23
         $message = preg_replace('/\[b\](.+?)\[\/b\]/is', '<span style="font-weight:bold">$1</span>', $message);
23 24
         $message = preg_replace('/\[u\](.+?)\[\/u\]/is', '<span style="text-decoration:underline">$1</span>', $message);
Please login to merge, or discard this patch.