@@ -38,7 +38,7 @@ |
||
38 | 38 | public function parse() |
39 | 39 | { |
40 | 40 | if ($this->responseQueueItem()->getCommand() === '@') { |
41 | - return $this->source(); |
|
41 | + return $this->source(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return false; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - // $sub = str_replace(["<", ">"], ["<", ">"], $sub); |
|
89 | + // $sub = str_replace(["<", ">"], ["<", ">"], $sub); |
|
90 | 90 | |
91 | 91 | $source = str_replace($match[0], $sub, $source); |
92 | 92 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | if (strpos($sub, '.') > -1) { |
76 | 76 | $parts = explode('.', $sub); |
77 | 77 | if (count($parts) !== 0) { |
78 | - array_walk($parts, static function (&$part) { |
|
78 | + array_walk($parts, static function(&$part) { |
|
79 | 79 | $part = ucfirst(trim($part)); |
80 | 80 | }); |
81 | 81 | } |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | * @return void |
264 | 264 | */ |
265 | 265 | public function warn(string $message, |
266 | - array $args = [], |
|
267 | - int $verbosity = Rivescript::VERBOSITY_DEBUG): void |
|
266 | + array $args = [], |
|
267 | + int $verbosity = Rivescript::VERBOSITY_DEBUG): void |
|
268 | 268 | { |
269 | 269 | $message = "[WARNING]: " . $this->formatString($message, $args); |
270 | 270 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @return void |
282 | 282 | */ |
283 | 283 | public function debug(string $message, |
284 | - array $args = [], |
|
285 | - int $verbosity = Rivescript::VERBOSITY_NORMAL): void |
|
284 | + array $args = [], |
|
285 | + int $verbosity = Rivescript::VERBOSITY_NORMAL): void |
|
286 | 286 | { |
287 | 287 | $message = "[DEBUG]: " . $this->formatString($message, $args); |
288 | 288 |
@@ -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 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | $rivescript->stream($script); |
26 | 26 | |
27 | 27 | $rivescript->on(Event::DEBUG, 'onDebug') |
28 | - ->on(Event::DEBUG_VERBOSE, 'onVerbose'); |
|
28 | + ->on(Event::DEBUG_VERBOSE, 'onVerbose'); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | echo $rivescript->reply("hi bot"); |
32 | 32 | \ No newline at end of file |
@@ -4,7 +4,7 @@ |
||
4 | 4 | use Axiom\Rivescript\Events\Event; |
5 | 5 | use Axiom\Rivescript\Rivescript; |
6 | 6 | |
7 | -$script =<<<EOF |
|
7 | +$script = <<<EOF |
|
8 | 8 | + hi bot |
9 | 9 | - hello human |
10 | 10 | EOF; |
@@ -40,9 +40,9 @@ |
||
40 | 40 | public function parse(Node $node): void |
41 | 41 | { |
42 | 42 | $types = [ |
43 | - '-', '*', |
|
44 | - '^', '@', |
|
45 | - '%' |
|
43 | + '-', '*', |
|
44 | + '^', '@', |
|
45 | + '%' |
|
46 | 46 | ]; |
47 | 47 | |
48 | 48 | if (in_array($node->command(), $types) === true) { |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $key = -1; |
57 | 57 | foreach (synapse()->brain->topic($topic)->triggers() as $index => $info) { |
58 | 58 | if ($info->getText() === $string) { |
59 | - $trigger= $info; |
|
59 | + $trigger = $info; |
|
60 | 60 | $key = $index; |
61 | 61 | break; |
62 | 62 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $triggers = $this->determineWordCount($triggers); |
103 | 103 | $triggers = $this->determineTypeCount($triggers); |
104 | 104 | |
105 | - return $triggers->sort(function ($current, $previous) { |
|
105 | + return $triggers->sort(function($current, $previous) { |
|
106 | 106 | return ($current->getOrder() < $previous->getOrder()) ? -1 : 1; |
107 | 107 | })->reverse(); |
108 | 108 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function determineTypeCount(Collection $triggers): Collection |
118 | 118 | { |
119 | - return $triggers->each(function (&$trigger) use ($triggers) { |
|
119 | + return $triggers->each(function(&$trigger) use ($triggers) { |
|
120 | 120 | |
121 | 121 | $order = $trigger->getOrder(); |
122 | 122 | $type = $trigger->getType(); |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $triggers = synapse()->brain->topic($topic)->triggers(); |
76 | 76 | |
77 | 77 | if ($recursion === synapse()->memory->global()->get('depth')) { |
78 | - synapse()->rivescript->warn("Top many recursive calls to :func", ["func" => __CLASS__ . "::" . __FUNCTION__]); |
|
78 | + synapse()->rivescript->warn("Top many recursive calls to :func", ["func" => __CLASS__."::".__FUNCTION__]); |
|
79 | 79 | return "ERR: Deep Recursion Detected"; |
80 | 80 | } |
81 | 81 |
@@ -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 | } |
@@ -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 |