@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | $this->rs = new Rivescript(); |
75 | 75 | $this->rs->setClientId($this->client_id); |
76 | 76 | |
77 | - $this->rs->on(Event::DEBUG, function ($msg) { |
|
77 | + $this->rs->on(Event::DEBUG, function($msg) { |
|
78 | 78 | echo "{$msg}\n"; |
79 | 79 | }) |
80 | - ->on(Event::DEBUG_VERBOSE, function ($msg) { |
|
80 | + ->on(Event::DEBUG_VERBOSE, function($msg) { |
|
81 | 81 | echo "{$msg}\n"; |
82 | 82 | }); |
83 | 83 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | $expected = rtrim($expected, "\n"); |
120 | 120 | if (strtolower($reply) !== strtolower($expected)) { |
121 | 121 | throw new AssertionError( |
122 | - "Got unexpected exception from reply() for input: {$step['input']}\n\n" . |
|
123 | - " Expected: {$expected}\n" . |
|
122 | + "Got unexpected exception from reply() for input: {$step['input']}\n\n". |
|
123 | + " Expected: {$expected}\n". |
|
124 | 124 | " Got: {$reply}" |
125 | 125 | ); |
126 | 126 | } |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | if ($correct === 0) { |
137 | 137 | $expected = implode(' or ', $expected); |
138 | 138 | throw new AssertionError( |
139 | - "Got unexpected exception from reply() for input: {$step['input']}\n\n" . |
|
140 | - " Expected: {$expected}\n" . |
|
139 | + "Got unexpected exception from reply() for input: {$step['input']}\n\n". |
|
140 | + " Expected: {$expected}\n". |
|
141 | 141 | " Got: {$reply}" |
142 | 142 | ); |
143 | 143 | } |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | |
176 | 176 | if ($actual != $value) { |
177 | 177 | throw new AssertionError( |
178 | - "Failed to assert that the value of user variable: {$key}\n\n" . |
|
179 | - " Expected: {$expected}\n" . |
|
178 | + "Failed to assert that the value of user variable: {$key}\n\n". |
|
179 | + " Expected: {$expected}\n". |
|
180 | 180 | " Got: {$actual}" |
181 | 181 | ); |
182 | 182 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | private function fail(AssertionError $e): void |
244 | 244 | { |
245 | 245 | $banner = "x {$this->name}"; |
246 | - $banner .= "\n " . str_repeat("=", strlen($banner)) . "\n"; |
|
246 | + $banner .= "\n ".str_repeat("=", strlen($banner))."\n"; |
|
247 | 247 | |
248 | 248 | echo " {$banner} {$e->getMessage()} \n\n"; |
249 | 249 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | if ($wildcards) { |
62 | 62 | $wildcards = Collection::make($wildcards)->flatten()->all(); |
63 | 63 | |
64 | - // $x = synapse()->memory->shortTerm()->get('wildcards'); |
|
64 | + // $x = synapse()->memory->shortTerm()->get('wildcards'); |
|
65 | 65 | // $trigger = synapse()->memory->shortTerm()->get('trigger'); |
66 | 66 | |
67 | 67 | // synapse()->memory->shortTerm()->put('wildcards', $wildcards); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $trigger = $this->parseTags($trigger, $input); |
45 | 45 | |
46 | 46 | $wildcards = [ |
47 | - // '/@(\s+)/' => ".*?\b", |
|
47 | + // '/@(\s+)/' => ".*?\b", |
|
48 | 48 | '/_/' => '[^\s\d]+?', |
49 | 49 | '/#/' => '\\d+?', |
50 | 50 | '/\*/' => '.*?', |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | - if (@preg_match_all('/' . $parsedTrigger . '/ui', $input->source(), $results)) { |
|
74 | + if (@preg_match_all('/'.$parsedTrigger.'/ui', $input->source(), $results)) { |
|
75 | 75 | $replacement = $results[1][0]; |
76 | 76 | $pattern = "(@{$array_name})"; |
77 | 77 | |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | foreach ($wildcards as $pattern => $replacement) { |
88 | - $parsedTrigger = preg_replace($pattern, '(' . $replacement . ')', $trigger); |
|
88 | + $parsedTrigger = preg_replace($pattern, '('.$replacement.')', $trigger); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | if ($parsedTrigger === $trigger) { |
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | |
95 | - if (@preg_match_all('/' . $parsedTrigger . '$/ui', $input->source(), $results)) { |
|
95 | + if (@preg_match_all('/'.$parsedTrigger.'$/ui', $input->source(), $results)) { |
|
96 | 96 | synapse()->rivescript->say("Wildcard trigger"); |
97 | 97 | array_shift($results); |
98 | 98 |
@@ -93,10 +93,10 @@ |
||
93 | 93 | |
94 | 94 | foreach ($result as $wildcard) { |
95 | 95 | $wildcards[] = $wildcard[0]; |
96 | - // $source = str_replace("(@{$name})", $wildcard[0], $source); |
|
96 | + // $source = str_replace("(@{$name})", $wildcard[0], $source); |
|
97 | 97 | } |
98 | 98 | |
99 | - // synapse()->memory->shortTerm()->put("wildcards", $wildcards); |
|
99 | + // synapse()->memory->shortTerm()->put("wildcards", $wildcards); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } else { |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * Find the match |
86 | 86 | */ |
87 | - $regex = "(" . implode('|', $array) . ")"; |
|
88 | - if (@preg_match_all('/' . $regex . '/ui', $input->source(), $result)) { |
|
87 | + $regex = "(".implode('|', $array).")"; |
|
88 | + if (@preg_match_all('/'.$regex.'/ui', $input->source(), $result)) { |
|
89 | 89 | if ($result) { |
90 | 90 | array_shift($result); |
91 | 91 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * Find the match |
105 | 105 | */ |
106 | - $regex = "(?:" . implode('|', $array) . ")"; |
|
106 | + $regex = "(?:".implode('|', $array).")"; |
|
107 | 107 | |
108 | - if (@preg_match_all('/' . $regex . '/ui', $source, $results)) { |
|
108 | + if (@preg_match_all('/'.$regex.'/ui', $source, $results)) { |
|
109 | 109 | foreach ($results as $result) { |
110 | 110 | $source = str_replace("@{$name}", $result[0], $source); |
111 | 111 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | parent::__construct(); |
101 | 101 | |
102 | - include __DIR__ . '/bootstrap.php'; |
|
102 | + include __DIR__.'/bootstrap.php'; |
|
103 | 103 | |
104 | 104 | synapse()->brain->setMaster($this); |
105 | 105 | synapse()->rivescript = $this; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | private function registerTags(): void |
124 | 124 | { |
125 | 125 | synapse()->tags->each( |
126 | - function ($tag) { |
|
126 | + function($tag) { |
|
127 | 127 | $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag"; |
128 | 128 | $tagInstance = new $class(); |
129 | 129 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | array $args = [], |
272 | 272 | int $verbosity = Rivescript::VERBOSITY_DEBUG): void |
273 | 273 | { |
274 | - $message = "[WARNING]: " . $this->formatString($message, $args); |
|
274 | + $message = "[WARNING]: ".$this->formatString($message, $args); |
|
275 | 275 | |
276 | 276 | $this->emit(Event::DEBUG_WARNING, $message); |
277 | 277 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | array $args = [], |
290 | 290 | int $verbosity = Rivescript::VERBOSITY_NORMAL): void |
291 | 291 | { |
292 | - $message = "[DEBUG]: " . $this->formatString($message, $args); |
|
292 | + $message = "[DEBUG]: ".$this->formatString($message, $args); |
|
293 | 293 | |
294 | 294 | $this->emit(EVENT::DEBUG, $message); |
295 | 295 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $synapse->triggers = Axiom\Collections\Collection::make( |
51 | 51 | [ |
52 | 52 | "Atomic", |
53 | - // "Arrays", |
|
53 | + // "Arrays", |
|
54 | 54 | "Alternation", |
55 | 55 | "Wildcard", |
56 | 56 | "Redirect", |