@@ -43,7 +43,7 @@ |
||
43 | 43 | public function __construct() |
44 | 44 | { |
45 | 45 | $this->logger = new Monolog('rivescript'); |
46 | - $this->logger->pushHandler(new StreamHandler(__DIR__ . '/../../logs/' . date('m-d-y') . '.log', Monolog::DEBUG)); |
|
46 | + $this->logger->pushHandler(new StreamHandler(__DIR__.'/../../logs/'.date('m-d-y').'.log', Monolog::DEBUG)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | $source = $this->escapeUnknownTags($source); |
39 | 39 | |
40 | - synapse()->memory->tags()->each(function ($tag) use (&$source) { |
|
40 | + synapse()->memory->tags()->each(function($tag) use (&$source) { |
|
41 | 41 | $source = $tag->parse($source, synapse()->input); |
42 | 42 | }); |
43 | 43 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | parent::__construct(); |
72 | 72 | |
73 | - include __DIR__ . '/bootstrap.php'; |
|
73 | + include __DIR__.'/bootstrap.php'; |
|
74 | 74 | |
75 | 75 | synapse()->brain->setMaster($this); |
76 | 76 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | private function registerTags(): void |
86 | 86 | { |
87 | 87 | synapse()->tags->each( |
88 | - function ($tag) { |
|
88 | + function($tag) { |
|
89 | 89 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
90 | 90 | $tagInstance = new $class(); |
91 | 91 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $output->writeln('RiveScript Interpreter (PHP) -- Interactive Console v2.0'); |
88 | 88 | $output->writeln('--------------------------------------------------------'); |
89 | 89 | $output->writeln('RiveScript Version: 2.0'); |
90 | - $output->writeln('Currently Loaded Source: ' . $loadedSource); |
|
90 | + $output->writeln('Currently Loaded Source: '.$loadedSource); |
|
91 | 91 | $output->writeln(''); |
92 | 92 | $output->writeln('You are now chatting with a RiveScript bot. Type a message and press Return'); |
93 | 93 | $output->writeln('to send it. When finished, type "/quit" to exit the interactive console.'); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $reply = $this->rivescript->reply($message); |
177 | 177 | $response = "<info>{$reply}</info>"; |
178 | 178 | |
179 | - $output->writeln($bot . $response); |
|
179 | + $output->writeln($bot.$response); |
|
180 | 180 | |
181 | 181 | $this->waitForUserInput($input, $output); |
182 | 182 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if (is_dir($info)) { |
194 | 194 | $directory = realpath($info); |
195 | 195 | $files = []; |
196 | - $brains = glob($directory . '/*.rive'); |
|
196 | + $brains = glob($directory.'/*.rive'); |
|
197 | 197 | |
198 | 198 | foreach ($brains as $brain) { |
199 | 199 | $files[] = $brain; |
@@ -297,16 +297,16 @@ |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | if ($parens) { |
300 | - return "Unmatched " . ($parens > 0 ? "left" : "right") . " parenthesis bracket ()"; |
|
300 | + return "Unmatched ".($parens > 0 ? "left" : "right")." parenthesis bracket ()"; |
|
301 | 301 | } |
302 | 302 | if ($square) { |
303 | - return "Unmatched " . ($square > 0 ? "left" : "right") . " square bracket []"; |
|
303 | + return "Unmatched ".($square > 0 ? "left" : "right")." square bracket []"; |
|
304 | 304 | } |
305 | 305 | if ($curly) { |
306 | - return "Unmatched " . ($curly > 0 ? "left" : "right") . " curly bracket {}"; |
|
306 | + return "Unmatched ".($curly > 0 ? "left" : "right")." curly bracket {}"; |
|
307 | 307 | } |
308 | 308 | if ($chevron) { |
309 | - return "Unmatched " . ($chevron > 0 ? "left" : "right") . " angled bracket <>"; |
|
309 | + return "Unmatched ".($chevron > 0 ? "left" : "right")." angled bracket <>"; |
|
310 | 310 | } |
311 | 311 | } elseif (starts_with($this->source, '-') || starts_with($this->source, '^') |
312 | 312 | || starts_with($this->source, '/')) { |
@@ -47,7 +47,7 @@ |
||
47 | 47 | [$key, $value] = explode('=', $value); |
48 | 48 | |
49 | 49 | $key = trim($key); |
50 | - $key = '/\b' . preg_quote($key, '/') . '\b/'; // Convert the "key" to a regular expression ready format |
|
50 | + $key = '/\b'.preg_quote($key, '/').'\b/'; // Convert the "key" to a regular expression ready format |
|
51 | 51 | $value = trim($value); |
52 | 52 | |
53 | 53 | synapse()->memory->substitute()->put($key, $value); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | private function sortResponses(Collection $responses): Collection |
95 | 95 | { |
96 | 96 | return $responses->sort( |
97 | - function ($current, $previous) { |
|
97 | + function($current, $previous) { |
|
98 | 98 | return ($current->order < $previous->order) ? -1 : 1; |
99 | 99 | } |
100 | 100 | )->reverse(); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $continues = Collection::make($responses->all()); |
144 | 144 | $continues->each( |
145 | - function (ResponseQueueItem $data, $response) use (&$lastData, &$lastResponse, &$continues) { |
|
145 | + function(ResponseQueueItem $data, $response) use (&$lastData, &$lastResponse, &$continues) { |
|
146 | 146 | |
147 | 147 | if ($data->type === 'continue') { |
148 | 148 | $continues->remove($lastResponse); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | private function determineResponseOrder(Collection $responses): Collection |
197 | 197 | { |
198 | 198 | return $responses->each( |
199 | - function (ResponseQueueItem $data, $response) use ($responses) { |
|
199 | + function(ResponseQueueItem $data, $response) use ($responses) { |
|
200 | 200 | if (isset($data->type)) { |
201 | 201 | switch ($data->type) { |
202 | 202 | case 'condition': |
@@ -111,7 +111,7 @@ |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | |
114 | - $commands->each(function ($command) use ($node) { |
|
114 | + $commands->each(function($command) use ($node) { |
|
115 | 115 | $class = "\\Axiom\\Rivescript\\Cortex\\Commands\\$command"; |
116 | 116 | $commandClass = new $class(); |
117 | 117 | $commandClass->parse($node); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $sub = ""; |
68 | 68 | |
69 | 69 | foreach ($patterns as $index => $pattern) { |
70 | - $patterns[$index] = "/\b" . $pattern . "\b/i"; |
|
70 | + $patterns[$index] = "/\b".$pattern."\b/i"; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // TODO: Test multiple person wildcards |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | if ($match[0] === '<person>' && is_array($wildcards) === true && count($wildcards) > 0) { |
77 | 77 | if (count($patterns) > 0) { |
78 | 78 | foreach ($patterns as $index => $pattern) { |
79 | - $sub = preg_replace($pattern, $replacements[$index], $wildcards[0]);// ?? 'undefined'; |
|
79 | + $sub = preg_replace($pattern, $replacements[$index], $wildcards[0]); // ?? 'undefined'; |
|
80 | 80 | |
81 | 81 | if ($sub !== $wildcards[0]) { |
82 | 82 | $source = str_replace($match[0], $sub, $source); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | } else { |
86 | - $sub = preg_replace($patterns, $replacements, $wildcards[0], 1);// ?? 'undefined'; |
|
86 | + $sub = preg_replace($patterns, $replacements, $wildcards[0], 1); // ?? 'undefined'; |
|
87 | 87 | $source = str_replace($match[0], $sub, $source); |
88 | 88 | } |
89 | 89 | } elseif ($match[1] === '{') { |
90 | - $key = "/\b" . preg_quote($match[3], '/') . "\b/"; |
|
90 | + $key = "/\b".preg_quote($match[3], '/')."\b/"; |
|
91 | 91 | $sub = synapse()->memory->person()->get($key) ?? "undefined"; |
92 | 92 | } |
93 | 93 | } |