@@ -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) { |
@@ -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,14 +76,14 @@ 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] === '{') { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function attach(Node $node): void |
82 | 82 | { |
83 | 83 | $type = $this->determineResponseType($node->source()); |
84 | - $queueItem = new ResponseQueueItem($node->command(), $type, 0, $this->options); |
|
84 | + $queueItem = new ResponseQueueItem($node->command(), $type, 0, $this->options); |
|
85 | 85 | $this->responses->put($node->value(), $queueItem); |
86 | 86 | } |
87 | 87 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | private function sortResponses(Collection $responses): Collection |
96 | 96 | { |
97 | 97 | return $responses->sort( |
98 | - function ($current, $previous) { |
|
98 | + function($current, $previous) { |
|
99 | 99 | return ($current->order < $previous->order) ? -1 : 1; |
100 | 100 | } |
101 | 101 | )->reverse(); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $continues = Collection::make($responses->all()); |
146 | 146 | $continues->each( |
147 | - function (ResponseQueueItem $data, $response) use (&$lastData, &$lastResponse, &$continues) { |
|
147 | + function(ResponseQueueItem $data, $response) use (&$lastData, &$lastResponse, &$continues) { |
|
148 | 148 | |
149 | 149 | if ($data->type === 'continue') { |
150 | 150 | $continues->remove($lastResponse); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | private function determineResponseOrder(Collection $responses): Collection |
198 | 198 | { |
199 | 199 | return $responses->each( |
200 | - function (ResponseQueueItem $data, $response) use ($responses) { |
|
200 | + function(ResponseQueueItem $data, $response) use ($responses) { |
|
201 | 201 | if (isset($data->type)) { |
202 | 202 | switch ($data->type) { |
203 | 203 | case 'condition': |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | protected function parseTags(string $source): string |
37 | 37 | { |
38 | - // $source = $this->escapeUnknownTags($source); |
|
38 | + // $source = $this->escapeUnknownTags($source); |
|
39 | 39 | |
40 | 40 | $tags = synapse()->memory->tags(); |
41 | 41 | foreach ($tags as $tag) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | parent::__construct(); |
79 | 79 | |
80 | - include __DIR__ . '/bootstrap.php'; |
|
80 | + include __DIR__.'/bootstrap.php'; |
|
81 | 81 | |
82 | 82 | synapse()->brain->setMaster($this); |
83 | 83 | synapse()->rivescript = $this; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | private function registerTags(): void |
94 | 94 | { |
95 | 95 | synapse()->tags->each( |
96 | - function ($tag) { |
|
96 | + function($tag) { |
|
97 | 97 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
98 | 98 | $tagInstance = new $class(); |
99 | 99 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | protected function searchTriggers(string $trigger): void |
79 | 79 | { |
80 | 80 | synapse()->triggers->each( |
81 | - function ($class) use ($trigger) { |
|
81 | + function($class) use ($trigger) { |
|
82 | 82 | $triggerClass = "\\Axiom\\Rivescript\\Cortex\\Triggers\\$class"; |
83 | 83 | $triggerClass = new $triggerClass(synapse()->input); |
84 | 84 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | protected function parseResponse(string $response): string |
155 | 155 | { |
156 | 156 | synapse()->tags->each( |
157 | - function ($tag) use (&$response) { |
|
157 | + function($tag) use (&$response) { |
|
158 | 158 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
159 | 159 | $tagClass = new $class(); |
160 | 160 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | protected function parseTags(string $trigger, Input $input): string |
44 | 44 | { |
45 | - synapse()->tags->each(function ($tag) use (&$trigger, $input) { |
|
45 | + synapse()->tags->each(function($tag) use (&$trigger, $input) { |
|
46 | 46 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
47 | 47 | $tagClass = new $class("trigger"); |
48 | 48 |
@@ -52,13 +52,13 @@ |
||
52 | 52 | ]; |
53 | 53 | |
54 | 54 | foreach ($wildcards as $pattern => $replacement) { |
55 | - $parsedTrigger = preg_replace($pattern, '(' . $replacement . ')', $trigger); |
|
55 | + $parsedTrigger = preg_replace($pattern, '('.$replacement.')', $trigger); |
|
56 | 56 | |
57 | 57 | if ($parsedTrigger === $trigger) { |
58 | 58 | continue; |
59 | 59 | } |
60 | 60 | |
61 | - if (@preg_match_all('/' . $parsedTrigger . '$/iu', $input->source(), $wildcards)) { |
|
61 | + if (@preg_match_all('/'.$parsedTrigger.'$/iu', $input->source(), $wildcards)) { |
|
62 | 62 | array_shift($wildcards); |
63 | 63 | |
64 | 64 | $wildcards = Collection::make($wildcards)->flatten()->all(); |