Completed
Pull Request — develop (#28)
by Sergio
02:26
created
src/Zanzara/Listener/ListenerCollector.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function onCommand(string $command, $callback): MiddlewareCollector
87 87
     {
88 88
         $pattern = str_replace('/', '\/', "/{$command}");
89
-        $command = '/^'.preg_replace(self::PARAMETER_REGEX, '(?<$1>.*)', $pattern).' ?$/miu';
89
+        $command = '/^' . preg_replace(self::PARAMETER_REGEX, '(?<$1>.*)', $pattern) . ' ?$/miu';
90 90
 
91 91
         $listener = new Listener($callback, $this->container, $command);
92 92
         $this->listeners['messages'][$command] = $listener;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function onText(string $text, $callback): MiddlewareCollector
110 110
     {
111
-        $text = '/^'.preg_replace(self::PARAMETER_REGEX, '(?<$1>.*)', $text).' ?$/miu';
111
+        $text = '/^' . preg_replace(self::PARAMETER_REGEX, '(?<$1>.*)', $text) . ' ?$/miu';
112 112
         $listener = new Listener($callback, $this->container, $text);
113 113
         $this->listeners['messages'][$text] = $listener;
114 114
         return $listener;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function onCbQueryText(string $text, $callback): MiddlewareCollector
186 186
     {
187
-        $text = '/^'.preg_replace(self::PARAMETER_REGEX, '(?<$1>.*)', $text).' ?$/miu';
187
+        $text = '/^' . preg_replace(self::PARAMETER_REGEX, '(?<$1>.*)', $text) . ' ?$/miu';
188 188
         $listener = new Listener($callback, $this->container, $text);
189 189
         $this->listeners['cb_query_texts'][$text] = $listener;
190 190
         return $listener;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         // merge values with "|" (eg. "accept|refuse|later"), then ListenerResolver will check the callback data
210 210
         // against that regex.
211
-        $id = '/'.implode('|', $data).'/';
211
+        $id = '/' . implode('|', $data) . '/';
212 212
         $listener = new Listener($callback, $this->container, $id);
213 213
         $this->listeners['cb_query_data'][$id] = $listener;
214 214
         return $listener;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
      */
474 474
     protected function feedMiddlewareStack()
475 475
     {
476
-        array_walk_recursive($this->listeners, function ($value) {
476
+        array_walk_recursive($this->listeners, function($value) {
477 477
             if ($value instanceof Listener) {
478 478
                 foreach ($this->middleware as $m) {
479 479
                     $value->middleware($m);
Please login to merge, or discard this patch.