@@ -38,7 +38,7 @@ |
||
| 38 | 38 | |
| 39 | 39 | private function callable($function) : callable |
| 40 | 40 | { |
| 41 | - return function () use ($function) { |
|
| 41 | + return function() use ($function) { |
|
| 42 | 42 | call_user_func($function); |
| 43 | 43 | }; |
| 44 | 44 | } |
@@ -98,6 +98,9 @@ discard block |
||
| 98 | 98 | return $this->formatReadable($entity, $readable); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | + /** |
|
| 102 | + * @param string|false $readable |
|
| 103 | + */ |
|
| 101 | 104 | public function formatUser(string $entity, $readable) : string |
| 102 | 105 | { |
| 103 | 106 | if ($readable) { |
@@ -112,6 +115,9 @@ discard block |
||
| 112 | 115 | return $entity; |
| 113 | 116 | } |
| 114 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string|false $readable |
|
| 120 | + */ |
|
| 115 | 121 | public function formatChannel(string $entity, $readable) : string |
| 116 | 122 | { |
| 117 | 123 | if ($readable) { |
@@ -126,6 +132,9 @@ discard block |
||
| 126 | 132 | return $entity; |
| 127 | 133 | } |
| 128 | 134 | |
| 135 | + /** |
|
| 136 | + * @param string|false $readable |
|
| 137 | + */ |
|
| 129 | 138 | public function formatReadable(string $match, $readable) : string |
| 130 | 139 | { |
| 131 | 140 | return $readable ?? $match; |
@@ -84,6 +84,9 @@ |
||
| 84 | 84 | return $matches; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | + /** |
|
| 88 | + * @param string $msg |
|
| 89 | + */ |
|
| 87 | 90 | private function debug($msg) |
| 88 | 91 | { |
| 89 | 92 | $this->debug("MethodMatcher {$this->name}: $msg"); |
@@ -56,6 +56,9 @@ |
||
| 56 | 56 | return true; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | + /** |
|
| 60 | + * @param string $msg |
|
| 61 | + */ |
|
| 59 | 62 | private function debug($msg) |
| 60 | 63 | { |
| 61 | 64 | $this->log(LogLevel::DEBUG, "PluginMatcher {$this->pluginId}: $msg"); |
@@ -115,6 +115,9 @@ |
||
| 115 | 115 | $this->realTimeClient->apiCall('chat.postMessage', $parameters); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string $event |
|
| 120 | + */ |
|
| 118 | 121 | public function on($event, array $onMessage) |
| 119 | 122 | { |
| 120 | 123 | $this->realTimeClient->on($event, function (Payload $payload) use ($onMessage) { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | public function on($event, array $onMessage) |
| 119 | 119 | { |
| 120 | - $this->realTimeClient->on($event, function (Payload $payload) use ($onMessage) { |
|
| 120 | + $this->realTimeClient->on($event, function(Payload $payload) use ($onMessage) { |
|
| 121 | 121 | call_user_func($onMessage, $payload); |
| 122 | 122 | }); |
| 123 | 123 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | public function updateAuthedUser(Closure $authedUserUpdated) |
| 176 | 176 | { |
| 177 | - $this->realTimeClient->getAuthedUser()->then(function (User $user) use ($authedUserUpdated) { |
|
| 177 | + $this->realTimeClient->getAuthedUser()->then(function(User $user) use ($authedUserUpdated) { |
|
| 178 | 178 | $this->authedUser = $user; |
| 179 | 179 | $authedUserUpdated($user); |
| 180 | 180 | }); |
@@ -137,11 +137,17 @@ |
||
| 137 | 137 | return implode("\n", $statuses); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | + /** |
|
| 141 | + * @param integer $interval |
|
| 142 | + */ |
|
| 140 | 143 | public function addTimer($interval, callable $callback) |
| 141 | 144 | { |
| 142 | 145 | $this->eventLoop->addTimer($interval, $callback); |
| 143 | 146 | } |
| 144 | 147 | |
| 148 | + /** |
|
| 149 | + * @param integer $interval |
|
| 150 | + */ |
|
| 145 | 151 | public function addPeriodicTimer($interval, callable $callback) |
| 146 | 152 | { |
| 147 | 153 | $this->eventLoop->addPeriodicTimer($interval, $callback); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $slack = $this->getSlack(); |
| 94 | 94 | |
| 95 | - $slack->update(function (User $authedUser) { |
|
| 95 | + $slack->update(function(User $authedUser) { |
|
| 96 | 96 | $this->pluginManager->updatePrefixes($authedUser->getUsername()); |
| 97 | 97 | }); |
| 98 | 98 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $this->addTimer($delay, function() { |
| 158 | 158 | $this->info($this->getFormattedMemoryUsage()); |
| 159 | - $this->addPeriodicTimer(3600, function () { |
|
| 159 | + $this->addPeriodicTimer(3600, function() { |
|
| 160 | 160 | $this->info($this->getFormattedMemoryUsage()); |
| 161 | 161 | }); |
| 162 | 162 | }); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $replaced = []; |
| 47 | 47 | foreach ($matchers as $name => $params) { |
| 48 | - $params['patterns'] = array_map(function ($pattern) use ($search, $replace) { |
|
| 48 | + $params['patterns'] = array_map(function($pattern) use ($search, $replace) { |
|
| 49 | 49 | return str_replace($search, $replace, $pattern); |
| 50 | 50 | }, $params['patterns']); |
| 51 | 51 | $replaced[$name] = $params; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $this->warning("{$this->pluginId} no method named: $method"); |
| 103 | 103 | } |
| 104 | 104 | } catch (Exception $e) { |
| 105 | - $this->warning('Exception in ' . static::class . '::' . $method); |
|
| 105 | + $this->warning('Exception in '.static::class.'::'.$method); |
|
| 106 | 106 | $this->warning($e->getMessage()); |
| 107 | 107 | $this->warning($e->getTraceAsString()); |
| 108 | 108 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | preg_match($pattern, '', $matches); |
| 195 | 195 | $patterns[] = $pattern; |
| 196 | 196 | } catch (Throwable $e) { |
| 197 | - $this->warning("$name.pattern='$pattern' " . $e->getMessage()); |
|
| 197 | + $this->warning("$name.pattern='$pattern' ".$e->getMessage()); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | $params['patterns'] = $patterns; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } else { |
| 60 | 60 | $line = str_replace('<prefix>', $prefix, $line); |
| 61 | 61 | } |
| 62 | - $help[] = ' ' . $line; |
|
| 62 | + $help[] = ' '.$line; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | foreach ($this->getPrefixMap() as $prefix => $plugins) { |
| 77 | 77 | /** @var PluginInterface $plugin */ |
| 78 | 78 | foreach ($plugins as $pluginId => $plugin) { |
| 79 | - $statuses[] = "$pluginId " . $plugin->status(); |
|
| 79 | + $statuses[] = "$pluginId ".$plugin->status(); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | foreach ($this->getPrefixMap() as $prefix => $plugins) { |
| 129 | 129 | if ($prefix === Yabot::AUTHED_USER) { |
| 130 | - $prefix = '@' . $authedUsername; |
|
| 130 | + $prefix = '@'.$authedUsername; |
|
| 131 | 131 | } elseif (!$prefix) { |
| 132 | 132 | $prefix = self::NO_PREFIX; |
| 133 | 133 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | public function getParameterOrDefault($name, array $default = []) : array |
| 58 | 58 | { |
| 59 | - return $this->hasParameter($name)? $this->getParameter($name) : $default; |
|
| 59 | + return $this->hasParameter($name) ? $this->getParameter($name) : $default; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | private function getTaggedPlugins($tag) : array |