@@ -16,7 +16,7 @@ |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
19 | - * @param $key |
|
19 | + * @param string $key |
|
20 | 20 | * @return string |
21 | 21 | */ |
22 | 22 | protected function getFilename($key) |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | $saved = $this->get($key)->merge($data); |
38 | 38 | |
39 | - if (! is_dir(dirname($file))) { |
|
39 | + if ( ! is_dir(dirname($file))) { |
|
40 | 40 | mkdir(dirname($file), 0777, true); |
41 | 41 | } |
42 | 42 | file_put_contents($file, json_encode($saved->all())); |
@@ -82,7 +82,7 @@ |
||
82 | 82 | /** |
83 | 83 | * Namespace botman keys in redis. |
84 | 84 | * |
85 | - * @param $key |
|
85 | + * @param string $key |
|
86 | 86 | * @return string |
87 | 87 | */ |
88 | 88 | private function decorateKey($key) |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function __construct($host = '127.0.0.1', $port = 6379, $auth = null) |
29 | 29 | { |
30 | - if (! class_exists(Redis::class)) { |
|
30 | + if ( ! class_exists(Redis::class)) { |
|
31 | 31 | throw new RuntimeException('phpredis extension is required for RedisStorage'); |
32 | 32 | } |
33 | 33 | $this->host = $host; |
@@ -109,7 +109,7 @@ |
||
109 | 109 | { |
110 | 110 | $entities = Collection::make($message->getExtras())->get('entities', []); |
111 | 111 | |
112 | - if (! empty($entities)) { |
|
112 | + if ( ! empty($entities)) { |
|
113 | 113 | foreach ($entities as $name => $entity) { |
114 | 114 | if ($name === 'intent') { |
115 | 115 | foreach ($entity as $item) { |
@@ -74,7 +74,7 @@ |
||
74 | 74 | */ |
75 | 75 | public function applyMiddleware($method, $payload, array $additionalMiddleware = [], Closure $destination = null) |
76 | 76 | { |
77 | - $destination = is_null($destination) ? function ($payload) { |
|
77 | + $destination = is_null($destination) ? function($payload) { |
|
78 | 78 | return $payload; |
79 | 79 | } |
80 | 80 | : $destination; |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @param Matching[] ...$middleware |
65 | - * @return Matching[]|$this |
|
65 | + * @return Matching[] |
|
66 | 66 | */ |
67 | 67 | public function matching(Matching ...$middleware) |
68 | 68 | { |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * @param string $name |
95 | 95 | * @param array $config |
96 | 96 | * @param Request|null $request |
97 | - * @return mixed|HttpDriver|NullDriver |
|
97 | + * @return HttpDriver |
|
98 | 98 | */ |
99 | 99 | public static function loadFromName($name, array $config, Request $request = null) |
100 | 100 | { |
@@ -47,7 +47,7 @@ |
||
47 | 47 | */ |
48 | 48 | public static function getAvailableHttpDrivers() |
49 | 49 | { |
50 | - return Collection::make(self::$drivers)->filter(function ($driver) { |
|
50 | + return Collection::make(self::$drivers)->filter(function($driver) { |
|
51 | 51 | return is_subclass_of($driver, HttpDriver::class); |
52 | 52 | })->toArray(); |
53 | 53 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * Get a stored conversation array from the cache for a given message. |
50 | 50 | * |
51 | 51 | * @param null|IncomingMessage $message |
52 | - * @return array |
|
52 | + * @return callable |
|
53 | 53 | */ |
54 | 54 | public function getStoredConversation($message = null) |
55 | 55 | { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function startConversation(Conversation $instance, $recipient = null, $driver = null) |
22 | 22 | { |
23 | - if (! is_null($recipient) && ! is_null($driver)) { |
|
23 | + if ( ! is_null($recipient) && ! is_null($driver)) { |
|
24 | 24 | $this->message = new IncomingMessage('', $recipient, ''); |
25 | 25 | $this->driver = DriverManager::loadFromName($driver, $this->config); |
26 | 26 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function touchCurrentConversation() |
76 | 76 | { |
77 | - if (! is_null($this->currentConversationData)) { |
|
77 | + if ( ! is_null($this->currentConversationData)) { |
|
78 | 78 | $touched = $this->currentConversationData; |
79 | 79 | $touched['time'] = microtime(); |
80 | 80 | |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | { |
168 | 168 | $this->loadedConversation = false; |
169 | 169 | |
170 | - Collection::make($this->getMessages())->reject(function (IncomingMessage $message) { |
|
170 | + Collection::make($this->getMessages())->reject(function(IncomingMessage $message) { |
|
171 | 171 | return $message->isFromBot(); |
172 | - })->filter(function (IncomingMessage $message) { |
|
172 | + })->filter(function(IncomingMessage $message) { |
|
173 | 173 | return $this->cache->has($message->getConversationIdentifier()) || $this->cache->has($message->getOriginatedConversationIdentifier()); |
174 | - })->each(function ($message) { |
|
174 | + })->each(function($message) { |
|
175 | 175 | $message = $this->middleware->applyMiddleware('received', $message); |
176 | 176 | $message = $this->middleware->applyMiddleware('captured', $message); |
177 | 177 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | /** @var \BotMan\BotMan\Messages\Conversations\Conversation $conversation */ |
247 | 247 | $conversation = $convo['conversation']; |
248 | - if (! $conversation instanceof ShouldQueue) { |
|
248 | + if ( ! $conversation instanceof ShouldQueue) { |
|
249 | 249 | $conversation->setBot($this); |
250 | 250 | } |
251 | 251 | /* |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | $conversation = $this->bot->getStoredConversation(); |
121 | 121 | |
122 | - if (! $question instanceof Question && ! $question) { |
|
122 | + if ( ! $question instanceof Question && ! $question) { |
|
123 | 123 | $question = unserialize($conversation['question']); |
124 | 124 | } |
125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if (is_string($next)) { |
130 | 130 | $next = unserialize($next)->getClosure(); |
131 | 131 | } elseif (is_array($next)) { |
132 | - $next = Collection::make($next)->map(function ($callback) { |
|
132 | + $next = Collection::make($next)->map(function($callback) { |
|
133 | 133 | if ($this->bot->getDriver()->serializesCallbacks() && ! $this->bot->runsOnSocket()) { |
134 | 134 | $callback['callback'] = unserialize($callback['callback'])->getClosure(); |
135 | 135 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | public function __sleep() |
184 | 184 | { |
185 | 185 | $properties = get_object_vars($this); |
186 | - if (! $this instanceof ShouldQueue) { |
|
186 | + if ( ! $this instanceof ShouldQueue) { |
|
187 | 187 | unset($properties['bot']); |
188 | 188 | } |
189 | 189 |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * Should the conversation be skipped (temporarily). |
169 | 169 | * @param IncomingMessage $message |
170 | - * @return bool |
|
170 | + * @return boolean|null |
|
171 | 171 | */ |
172 | 172 | public function skipsConversation(IncomingMessage $message) |
173 | 173 | { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * Should the conversation be removed and stopped (permanently). |
179 | 179 | * @param IncomingMessage $message |
180 | - * @return bool |
|
180 | + * @return boolean|null |
|
181 | 181 | */ |
182 | 182 | public function stopsConversation(IncomingMessage $message) |
183 | 183 | { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Override default conversation cache time (only for this conversation). |
189 | - * @return mixed |
|
189 | + * @return integer|null |
|
190 | 190 | */ |
191 | 191 | public function getConversationCacheTime() |
192 | 192 | { |
@@ -87,7 +87,7 @@ |
||
87 | 87 | */ |
88 | 88 | public function getExtras($key = null) |
89 | 89 | { |
90 | - if (! is_null($key)) { |
|
90 | + if ( ! is_null($key)) { |
|
91 | 91 | return Collection::make($this->extras)->get($key); |
92 | 92 | } |
93 | 93 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * |
35 | 35 | * @param IncomingMessage $message |
36 | 36 | * @param array $parameters |
37 | - * @return array |
|
37 | + * @return callable |
|
38 | 38 | */ |
39 | 39 | public function addDataParameters(IncomingMessage $message, array $parameters) |
40 | 40 | { |
@@ -66,7 +66,7 @@ |
||
66 | 66 | public function getMatchingMessages($messages, MiddlewareManager $middleware, Answer $answer, DriverInterface $driver, $withReceivedMiddleware = true) : array |
67 | 67 | { |
68 | 68 | $matcher = new Matcher(); |
69 | - $messages = Collection::make($messages)->reject(function (IncomingMessage $message) { |
|
69 | + $messages = Collection::make($messages)->reject(function(IncomingMessage $message) { |
|
70 | 70 | return $message->isFromBot(); |
71 | 71 | }); |
72 | 72 |