@@ -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 | /** |
@@ -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); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | if (strpos($sub, '.') > -1) { |
74 | 74 | $parts = explode('.', $sub); |
75 | 75 | if (count($parts) !== 0) { |
76 | - array_walk($parts, static function (&$part) { |
|
76 | + array_walk($parts, static function(&$part) { |
|
77 | 77 | $part = ucfirst(trim($part)); |
78 | 78 | }); |
79 | 79 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $this->sourceType = $sourceType; |
63 | 63 | |
64 | 64 | if (!isset($this->allowedSources)) { |
65 | - throw new LogicException(get_class($this) . " must have an \"allowedSources\" property declared."); |
|
65 | + throw new LogicException(get_class($this)." must have an \"allowedSources\" property declared."); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $triggers = $this->determineWordCount($triggers); |
95 | 95 | $triggers = $this->determineTypeCount($triggers); |
96 | 96 | |
97 | - return $triggers->sort(function ($current, $previous) { |
|
97 | + return $triggers->sort(function($current, $previous) { |
|
98 | 98 | return ($current['order'] < $previous['order']) ? -1 : 1; |
99 | 99 | })->reverse(); |
100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function determineTypeCount(Collection $triggers): Collection |
110 | 110 | { |
111 | - return $triggers->each(function ($data, $trigger) use ($triggers) { |
|
111 | + return $triggers->each(function($data, $trigger) use ($triggers) { |
|
112 | 112 | if (isset($data['type'])) { |
113 | 113 | switch ($data['type']) { |
114 | 114 | case 'atomic': |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | protected function determineWordCount(Collection $triggers): Collection |
142 | 142 | { |
143 | - return $triggers->each(function ($data, $trigger) use ($triggers) { |
|
143 | + return $triggers->each(function($data, $trigger) use ($triggers) { |
|
144 | 144 | $data['order'] = count(explode(' ', $trigger)); |
145 | 145 | |
146 | 146 | $triggers->put($trigger, $data); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | stream_wrapper_unregister($this->name); |
71 | 71 | } |
72 | 72 | if (stream_wrapper_register($this->name, ContentStream::class) === true) { |
73 | - $this->stream = fopen($this->name . "://input", 'wb+'); |
|
73 | + $this->stream = fopen($this->name."://input", 'wb+'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | if (is_resource($this->stream) === false) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - if (@preg_match_all('/' . $trigger . '$/ui', $input->source(), $wildcards)) { |
|
58 | + if (@preg_match_all('/'.$trigger.'$/ui', $input->source(), $wildcards)) { |
|
59 | 59 | array_shift($wildcards); |
60 | 60 | |
61 | 61 | if ($wildcards) { |